mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 16:10:10 +00:00
Collapse LIB_FIELD into SCH_FIELD.
This commit is contained in:
parent
c241796968
commit
d77eae3e7e
common
eeschema
CMakeLists.txtsch_painter.cppsch_painter.hsch_screen.cppsch_symbol.cppsch_view.cpp
api
dialogs
dialog_change_symbols.cppdialog_field_properties.cppdialog_field_properties.hdialog_label_properties.cppdialog_label_properties.hdialog_lib_symbol_properties.cppdialog_lib_symbol_properties.hdialog_sheet_properties.cppdialog_sheet_properties.hdialog_sim_model.cppdialog_sim_model.hdialog_symbol_properties.cppdialog_symbol_properties.hdialog_update_symbol_fields.cpppanel_eeschema_color_settings.cpp
fields_grid_table.cppfields_grid_table.hgenerate_alias_info.cpplib_field.cpplib_field.hlib_symbol.cpplib_symbol.hlib_text.hnetlist_exporters
sch_commit.cppsch_field.cppsch_field.hsch_io
altium
cadstar
database
eagle
easyedapro
http_lib
kicad_legacy
kicad_sexpr
sch_io_kicad_sexpr.cppsch_io_kicad_sexpr_lib_cache.cppsch_io_kicad_sexpr_lib_cache.hsch_io_kicad_sexpr_parser.cppsch_io_kicad_sexpr_parser.h
sch_io_lib_cache.cppsim
symbol_editor
symbol_lib_table.cppsymbol_library.cpptools
backannotate.cppee_actions.cppee_grid_helper.cppee_inspection_tool.cppee_selection_tool.cppsch_edit_tool.cppsymbol_editor_edit_tool.cppsymbol_editor_edit_tool.hsymbol_editor_move_tool.cpp
widgets
include/core
pcbnew/pcb_io/cadstar
qa/tests
@ -79,7 +79,6 @@ KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
|
||||
case types::KiCadObjectType::KOT_LIB_TEXT: return LIB_TEXT_T;
|
||||
case types::KiCadObjectType::KOT_LIB_TEXTBOX: return LIB_TEXTBOX_T;
|
||||
case types::KiCadObjectType::KOT_LIB_PIN: return LIB_PIN_T;
|
||||
case types::KiCadObjectType::KOT_LIB_FIELD: return LIB_FIELD_T;
|
||||
case types::KiCadObjectType::KOT_WSG_LINE: return WSG_LINE_T;
|
||||
case types::KiCadObjectType::KOT_WSG_RECT: return WSG_RECT_T;
|
||||
case types::KiCadObjectType::KOT_WSG_POLY: return WSG_POLY_T;
|
||||
@ -143,7 +142,6 @@ types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
|
||||
case LIB_TEXT_T: return types::KiCadObjectType::KOT_LIB_TEXT;
|
||||
case LIB_TEXTBOX_T: return types::KiCadObjectType::KOT_LIB_TEXTBOX;
|
||||
case LIB_PIN_T: return types::KiCadObjectType::KOT_LIB_PIN;
|
||||
case LIB_FIELD_T: return types::KiCadObjectType::KOT_LIB_FIELD;
|
||||
case WSG_LINE_T: return types::KiCadObjectType::KOT_WSG_LINE;
|
||||
case WSG_RECT_T: return types::KiCadObjectType::KOT_WSG_RECT;
|
||||
case WSG_POLY_T: return types::KiCadObjectType::KOT_WSG_POLY;
|
||||
|
@ -400,7 +400,6 @@ static struct EDA_ITEM_DESC
|
||||
.Map( LIB_TEXT_T, _HKI( "Text" ) )
|
||||
.Map( LIB_TEXTBOX_T, _HKI( "Text Box" ) )
|
||||
.Map( LIB_PIN_T, _HKI( "Pin" ) )
|
||||
.Map( LIB_FIELD_T, _HKI( "Symbol Field" ) )
|
||||
|
||||
.Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) )
|
||||
.Map( GERBER_DRAW_ITEM_T, _HKI( "Draw Item" ) )
|
||||
|
@ -2775,21 +2775,15 @@ wxString CADSTAR_ARCHIVE_PARSER::HandleTextOverbar( wxString aCadstarString )
|
||||
}
|
||||
|
||||
|
||||
void CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextItem )
|
||||
void CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextItem, bool aInvertY )
|
||||
{
|
||||
if( !aKiCadTextItem->GetText().IsEmpty() )
|
||||
{
|
||||
VECTOR2I positionOffset( 0, aKiCadTextItem->GetInterline() );
|
||||
RotatePoint( positionOffset, aKiCadTextItem->GetTextAngle() );
|
||||
|
||||
EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
|
||||
|
||||
if( textEdaItem &&
|
||||
( textEdaItem->Type() == LIB_TEXT_T || textEdaItem->Type() == LIB_FIELD_T ) )
|
||||
{
|
||||
// Y coordinate increases upwards in the symbol editor
|
||||
if( aInvertY )
|
||||
positionOffset.y = -positionOffset.y;
|
||||
}
|
||||
|
||||
//Count num of additional lines
|
||||
wxString text = aKiCadTextItem->GetText();
|
||||
|
@ -1423,7 +1423,7 @@ public:
|
||||
* provided text element has been initialised with a position and orientation.
|
||||
* @param aKiCadTextItem a Kicad item to correct
|
||||
*/
|
||||
static void FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextItem );
|
||||
static void FixTextPositionNoAlignment( EDA_TEXT* aKiCadTextItem, bool aInvertY = false );
|
||||
|
||||
static wxString generateLibName( const wxString& aRefName, const wxString& aAlternateName );
|
||||
|
||||
|
@ -72,7 +72,7 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
|
||||
case VALUE_FIELD: return _( VALUE_CANONICAL ); // The symbol value
|
||||
case FOOTPRINT_FIELD: return _( FOOTPRINT_CANONICAL ); // The footprint for use with Pcbnew
|
||||
case DATASHEET_FIELD: return _( DATASHEET_CANONICAL ); // Link to a datasheet for symbol
|
||||
case DESCRIPTION_FIELD: return _( DESCRIPTION_CANONICAL ); // The symbol description
|
||||
case DESCRIPTION_FIELD: return _( DESCRIPTION_CANONICAL ); // The symbol description
|
||||
default: return wxString::Format( _( "Field%d" ), aFieldNdx );
|
||||
}
|
||||
}
|
||||
@ -208,13 +208,19 @@ void TEMPLATES::resolveTemplates()
|
||||
|
||||
for( const TEMPLATE_FIELDNAME& global : m_globals )
|
||||
{
|
||||
bool overriddenInProject = false;
|
||||
|
||||
for( const TEMPLATE_FIELDNAME& project : m_project )
|
||||
{
|
||||
if( global.m_Name == project.m_Name )
|
||||
continue;
|
||||
{
|
||||
overriddenInProject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_resolved.push_back( global );
|
||||
if( !overriddenInProject )
|
||||
m_resolved.push_back( global );
|
||||
}
|
||||
|
||||
m_resolvedDirty = false;
|
||||
|
@ -361,8 +361,7 @@ set( EESCHEMA_SRCS
|
||||
generate_alias_info.cpp
|
||||
gfx_import_utils.cpp
|
||||
picksymbol.cpp
|
||||
lib_field.cpp
|
||||
lib_pin.cpp
|
||||
lib_pin.cpp
|
||||
lib_shape.cpp
|
||||
lib_symbol.cpp
|
||||
lib_text.cpp
|
||||
|
@ -18,7 +18,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <lib_field.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_shape.h>
|
||||
#include <lib_symbol.h>
|
||||
@ -99,7 +98,6 @@ std::unique_ptr<EDA_ITEM> CreateItemForType( KICAD_T aType, EDA_ITEM* aContainer
|
||||
case LIB_TEXT_T: return std::make_unique<LIB_TEXT>( parentLibSymbol );
|
||||
case LIB_TEXTBOX_T: return std::make_unique<LIB_TEXTBOX>( parentLibSymbol );
|
||||
case LIB_PIN_T: return std::make_unique<LIB_PIN>( parentLibSymbol );
|
||||
case LIB_FIELD_T: return std::make_unique<LIB_FIELD>( parentLibSymbol );
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
|
@ -285,7 +285,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||
|
||||
// Load non-mandatory fields from all matching symbols and their library symbols
|
||||
std::vector<SCH_FIELD*> fields;
|
||||
std::vector<LIB_FIELD*> libFields;
|
||||
std::vector<SCH_FIELD*> libFields;
|
||||
std::set<wxString> fieldNames;
|
||||
|
||||
for( SCH_SHEET_PATH& instance : hierarchy )
|
||||
@ -415,7 +415,7 @@ void DIALOG_CHANGE_SYMBOLS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( i < MANDATORY_FIELDS )
|
||||
{
|
||||
LIB_FIELD dummy_field( i );
|
||||
SCH_FIELD dummy_field( nullptr, i );
|
||||
m_updateFields.insert( dummy_field.GetCanonicalName() );
|
||||
}
|
||||
else
|
||||
@ -636,7 +636,7 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
|
||||
for( unsigned i = 0; i < symbol->GetFields().size(); ++i )
|
||||
{
|
||||
SCH_FIELD& field = symbol->GetFields()[i];
|
||||
LIB_FIELD* libField = nullptr;
|
||||
SCH_FIELD* libField = nullptr;
|
||||
|
||||
// Mandatory fields always exist in m_updateFields, but these names can be translated.
|
||||
// so use GetCanonicalName().
|
||||
@ -715,12 +715,12 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<LIB_FIELD*> libFields;
|
||||
std::vector<SCH_FIELD*> libFields;
|
||||
symbol->GetLibSymbolRef()->GetFields( libFields );
|
||||
|
||||
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
|
||||
{
|
||||
const LIB_FIELD& libField = *libFields[i];
|
||||
const SCH_FIELD& libField = *libFields[i];
|
||||
|
||||
if( !alg::contains( m_updateFields, libField.GetCanonicalName() ) )
|
||||
continue;
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <sch_edit_frame.h>
|
||||
#include <ee_collectors.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <lib_field.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <symbol_library.h>
|
||||
#include <sch_validators.h>
|
||||
@ -50,19 +49,20 @@
|
||||
|
||||
|
||||
DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
const EDA_TEXT* aTextItem ) :
|
||||
const SCH_FIELD* aField ) :
|
||||
DIALOG_FIELD_PROPERTIES_BASE( aParent, wxID_ANY, aTitle ),
|
||||
m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
|
||||
m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
|
||||
m_font( nullptr ),
|
||||
m_firstFocus( true ),
|
||||
m_scintillaTricks( nullptr )
|
||||
m_scintillaTricks( nullptr ),
|
||||
m_field( aField )
|
||||
{
|
||||
COLOR_SETTINGS* colorSettings = aParent->GetColorSettings();
|
||||
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
wxASSERT( aTextItem );
|
||||
wxASSERT( m_field );
|
||||
|
||||
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
m_note->Show( false );
|
||||
@ -134,20 +134,142 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
|
||||
m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
|
||||
m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_FIELD_PROPERTIES::onVAlignButton, this );
|
||||
|
||||
m_text = aTextItem->GetText();
|
||||
m_isItalic = aTextItem->IsItalic();
|
||||
m_isBold = aTextItem->IsBold();
|
||||
m_color = aTextItem->GetTextColor();
|
||||
m_position = aTextItem->GetTextPos();
|
||||
m_size = aTextItem->GetTextWidth();
|
||||
m_isVertical = aTextItem->GetTextAngle().IsVertical();
|
||||
m_verticalJustification = aTextItem->GetVertJustify();
|
||||
m_horizontalJustification = aTextItem->GetHorizJustify();
|
||||
m_isVisible = aTextItem->IsVisible();
|
||||
// show text variable cross-references in a human-readable format
|
||||
if( aField->Schematic() )
|
||||
m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
|
||||
else
|
||||
m_text = aField->GetText();
|
||||
|
||||
// These should be initialized in the child classes implementing dialogs for lib and sch items.
|
||||
m_isNameVisible = false;
|
||||
m_allowAutoplace = true;
|
||||
m_font = m_field->GetFont();
|
||||
m_isItalic = aField->IsItalic();
|
||||
m_isBold = aField->IsBold();
|
||||
m_color = aField->GetTextColor();
|
||||
m_position = aField->GetTextPos();
|
||||
m_size = aField->GetTextWidth();
|
||||
m_isVertical = aField->GetTextAngle().IsVertical();
|
||||
m_verticalJustification = aField->GetVertJustify();
|
||||
m_horizontalJustification = aField->GetHorizJustify();
|
||||
m_isVisible = aField->IsVisible();
|
||||
|
||||
m_isSheetFilename = false;
|
||||
|
||||
if( aField->GetParent() && aField->GetParent()->Type() == LIB_SYMBOL_T )
|
||||
{
|
||||
const LIB_SYMBOL* symbol = static_cast<const LIB_SYMBOL*>( aField->GetParentSymbol() );
|
||||
|
||||
/*
|
||||
* Symbol netlist format:
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
symbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
wxArrayString pins;
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
wxArrayString fpFilters = symbol->GetFPFilters();
|
||||
|
||||
if( !fpFilters.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
m_netlist = netlist;
|
||||
}
|
||||
else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( aField->GetParentSymbol() );
|
||||
SCH_SHEET_PATH sheetPath = static_cast<SCH_EDIT_FRAME*>( aParent )->GetCurrentSheet();
|
||||
|
||||
m_fieldId = aField->GetId();
|
||||
|
||||
/*
|
||||
* Symbol netlist format:
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
wxArrayString pins;
|
||||
|
||||
for( SCH_PIN* pin : symbol->GetPins( &sheetPath ) )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
wxArrayString fpFilters = symbol->GetLibSymbolRef()->GetFPFilters();
|
||||
|
||||
if( !fpFilters.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
m_netlist = netlist;
|
||||
}
|
||||
else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
|
||||
{
|
||||
switch( aField->GetId() )
|
||||
{
|
||||
case SHEETNAME:
|
||||
m_fieldId = SHEETNAME_V;
|
||||
break;
|
||||
|
||||
case SHEETFILENAME:
|
||||
m_isSheetFilename = true;
|
||||
m_fieldId = SHEETFILENAME_V;
|
||||
m_note->SetLabel( wxString::Format( m_note->GetLabel(),
|
||||
_( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
|
||||
m_note->Show( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
m_fieldId = SHEETUSERFIELD_V;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( aField->GetParent() && aField->GetParent()->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
||||
{
|
||||
m_fieldId = LABELUSERFIELD_V;
|
||||
}
|
||||
|
||||
m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) );
|
||||
|
||||
m_position = m_field->GetPosition();
|
||||
|
||||
m_isNameVisible = m_field->IsNameShown();
|
||||
m_allowAutoplace = m_field->CanAutoplace();
|
||||
|
||||
m_horizontalJustification = m_field->GetEffectiveHorizJustify();
|
||||
m_verticalJustification = m_field->GetEffectiveVertJustify();
|
||||
|
||||
m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED,
|
||||
&DIALOG_FIELD_PROPERTIES::onScintillaCharAdded, this );
|
||||
m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED,
|
||||
&DIALOG_FIELD_PROPERTIES::onScintillaCharAdded, this );
|
||||
|
||||
m_nameVisible->Show();
|
||||
m_cbAllowAutoPlace->Show();
|
||||
|
||||
init();
|
||||
|
||||
if( m_isSheetFilename || m_field->IsNamedVariable() )
|
||||
{
|
||||
m_StyledTextCtrl->Enable( false );
|
||||
m_TextCtrl->Enable( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -414,63 +536,7 @@ void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText )
|
||||
}
|
||||
|
||||
|
||||
DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent,
|
||||
const wxString& aTitle,
|
||||
const LIB_FIELD* aField ) :
|
||||
DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField )
|
||||
{
|
||||
m_fieldId = aField->GetId();
|
||||
m_isNameVisible = aField->IsNameShown();
|
||||
m_allowAutoplace = aField->CanAutoplace();
|
||||
|
||||
if( m_fieldId == VALUE_FIELD )
|
||||
m_text = UnescapeString( aField->GetText() );
|
||||
|
||||
if( m_fieldId == FOOTPRINT_FIELD )
|
||||
{
|
||||
const LIB_SYMBOL* parentSymbol = static_cast<const LIB_SYMBOL*>( aField->GetParentSymbol() );
|
||||
|
||||
/*
|
||||
* Symbol netlist format:
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
parentSymbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
wxArrayString pins;
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
wxArrayString fpFilters = parentSymbol->GetFPFilters();
|
||||
|
||||
if( !fpFilters.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
m_netlist = netlist;
|
||||
}
|
||||
|
||||
m_font = aField->GetFont();
|
||||
|
||||
m_nameVisible->Show();
|
||||
m_cbAllowAutoPlace->Show();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_FIELD_PROPERTIES::UpdateField( LIB_FIELD* aField )
|
||||
void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField )
|
||||
{
|
||||
aField->SetText( m_text );
|
||||
|
||||
@ -485,114 +551,14 @@ void DIALOG_LIB_FIELD_PROPERTIES::UpdateField( LIB_FIELD* aField )
|
||||
}
|
||||
|
||||
|
||||
DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
const wxString& aTitle,
|
||||
const SCH_FIELD* aField ) :
|
||||
DIALOG_FIELD_PROPERTIES( aParent, aTitle, aField ),
|
||||
m_field( aField )
|
||||
{
|
||||
m_isSheetFilename = false;
|
||||
|
||||
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aField->GetParent() );
|
||||
SCH_SHEET_PATH sheetPath = aParent->GetCurrentSheet();
|
||||
|
||||
m_fieldId = aField->GetId();
|
||||
|
||||
/*
|
||||
* Symbol netlist format:
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
wxArrayString pins;
|
||||
|
||||
for( SCH_PIN* pin : symbol->GetPins( &sheetPath ) )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( pins, '\t' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
wxArrayString fpFilters = symbol->GetLibSymbolRef()->GetFPFilters();
|
||||
|
||||
if( !fpFilters.IsEmpty() )
|
||||
netlist << EscapeString( wxJoin( fpFilters, ' ' ), CTX_LINE );
|
||||
|
||||
netlist << wxS( "\r" );
|
||||
|
||||
m_netlist = netlist;
|
||||
}
|
||||
else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
|
||||
{
|
||||
switch( aField->GetId() )
|
||||
{
|
||||
case SHEETNAME:
|
||||
m_fieldId = SHEETNAME_V;
|
||||
break;
|
||||
|
||||
case SHEETFILENAME:
|
||||
m_isSheetFilename = true;
|
||||
m_fieldId = SHEETFILENAME_V;
|
||||
m_note->SetLabel( wxString::Format( m_note->GetLabel(),
|
||||
_( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
|
||||
m_note->Show( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
m_fieldId = SHEETUSERFIELD_V;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( aField->GetParent() && aField->GetParent()->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
||||
{
|
||||
m_fieldId = LABELUSERFIELD_V;
|
||||
}
|
||||
|
||||
// show text variable cross-references in a human-readable format
|
||||
m_text = aField->Schematic()->ConvertKIIDsToRefs( aField->GetText() );
|
||||
|
||||
m_font = m_field->GetFont();
|
||||
|
||||
m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) );
|
||||
|
||||
m_position = m_field->GetPosition();
|
||||
|
||||
m_isNameVisible = m_field->IsNameShown();
|
||||
m_allowAutoplace = m_field->CanAutoplace();
|
||||
|
||||
m_horizontalJustification = m_field->GetEffectiveHorizJustify();
|
||||
m_verticalJustification = m_field->GetEffectiveVertJustify();
|
||||
|
||||
m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded,
|
||||
this );
|
||||
m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED,
|
||||
&DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded, this );
|
||||
|
||||
m_nameVisible->Show();
|
||||
m_cbAllowAutoPlace->Show();
|
||||
|
||||
init();
|
||||
|
||||
if( m_isSheetFilename || m_field->IsNamedVariable() )
|
||||
{
|
||||
m_StyledTextCtrl->Enable( false );
|
||||
m_TextCtrl->Enable( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
|
||||
void DIALOG_FIELD_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
|
||||
{
|
||||
m_field->OnScintillaCharAdded( m_scintillaTricks, aEvent );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField,
|
||||
SCH_SHEET_PATH* aSheetPath )
|
||||
void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField,
|
||||
SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -28,8 +28,6 @@
|
||||
|
||||
#include <dialog_field_properties_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <lib_field.h>
|
||||
#include <template_fieldnames.h>
|
||||
|
||||
class SCH_BASE_FRAME;
|
||||
class SCH_FIELD;
|
||||
@ -39,8 +37,6 @@ class SCH_COMMIT;
|
||||
|
||||
|
||||
/**
|
||||
* A base class to edit schematic and symbol library fields.
|
||||
*
|
||||
* This class is setup in expectation of its children possibly using Kiway player so
|
||||
* #DIALOG_SHIM::ShowQuasiModal is required when calling any subclasses.
|
||||
*/
|
||||
@ -48,22 +44,28 @@ class DIALOG_FIELD_PROPERTIES : public DIALOG_FIELD_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
const EDA_TEXT* aTextItem );
|
||||
const SCH_FIELD* aField );
|
||||
|
||||
~DIALOG_FIELD_PROPERTIES() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
SCH_BASE_FRAME* GetParent() { return dynamic_cast< SCH_BASE_FRAME* >( wxDialog::GetParent() ); }
|
||||
SCH_BASE_FRAME* GetParent() { return dynamic_cast<SCH_BASE_FRAME*>( wxDialog::GetParent() ); }
|
||||
|
||||
const wxString& GetText() const { return m_text; }
|
||||
|
||||
void UpdateField( SCH_FIELD* aField );
|
||||
|
||||
void UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
void updateText( EDA_TEXT* aText );
|
||||
|
||||
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
|
||||
|
||||
/**
|
||||
* Handle the select button next to the text value field. The current assumption
|
||||
* is that this event will only be enabled for footprint type fields. In the future
|
||||
@ -78,7 +80,7 @@ protected:
|
||||
* Used to select the variant part of some text fields (for instance, the question mark
|
||||
* or number in a reference).
|
||||
*/
|
||||
virtual void OnSetFocusText( wxFocusEvent& event ) override;
|
||||
void OnSetFocusText( wxFocusEvent& event ) override;
|
||||
|
||||
void onOrientButton( wxCommandEvent &aEvent );
|
||||
void onHAlignButton( wxCommandEvent &aEvent );
|
||||
@ -108,46 +110,9 @@ protected:
|
||||
|
||||
SCINTILLA_TRICKS* m_scintillaTricks;
|
||||
std::string m_netlist;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle editing a single symbol field in the symbol editor.
|
||||
*
|
||||
* @note Use ShowQuasiModal when calling this class!
|
||||
*/
|
||||
class DIALOG_LIB_FIELD_PROPERTIES : public DIALOG_FIELD_PROPERTIES
|
||||
{
|
||||
public:
|
||||
DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
const LIB_FIELD* aField );
|
||||
|
||||
~DIALOG_LIB_FIELD_PROPERTIES() {}
|
||||
|
||||
void UpdateField( LIB_FIELD* aField );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle editing a single symbol field in the schematic editor.
|
||||
*
|
||||
* @note Use ShowQuasiModal when calling this class!
|
||||
*/
|
||||
class DIALOG_SCH_FIELD_PROPERTIES : public DIALOG_FIELD_PROPERTIES
|
||||
{
|
||||
public:
|
||||
DIALOG_SCH_FIELD_PROPERTIES( SCH_EDIT_FRAME* aParent, const wxString& aTitle,
|
||||
const SCH_FIELD* aField );
|
||||
|
||||
~DIALOG_SCH_FIELD_PROPERTIES() {}
|
||||
|
||||
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
|
||||
|
||||
void UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
private:
|
||||
const SCH_FIELD* m_field;
|
||||
bool m_isSheetFilename;
|
||||
const SCH_FIELD* m_field;
|
||||
bool m_isSheetFilename;
|
||||
};
|
||||
|
||||
#endif // DIALOG_FIELD_PROPERTIES_H
|
||||
|
@ -54,7 +54,7 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
|
||||
COLOR_SETTINGS* colorSettings = m_Parent->GetColorSettings();
|
||||
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_grid, m_currentLabel );
|
||||
m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_currentLabel );
|
||||
m_width = 100; // Will be later set to a better value
|
||||
m_delayedFocusRow = -1;
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
@ -407,7 +407,7 @@ static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b )
|
||||
}
|
||||
|
||||
|
||||
static bool positioningChanged( FIELDS_GRID_TABLE<SCH_FIELD>* a, std::vector<SCH_FIELD>& b )
|
||||
static bool positioningChanged( FIELDS_GRID_TABLE* a, std::vector<SCH_FIELD>& b )
|
||||
{
|
||||
for( size_t i = 0; i < a->size() && i < b.size(); ++i )
|
||||
{
|
||||
|
@ -61,21 +61,21 @@ private:
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
int m_width;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
int m_width;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
|
||||
SCH_LABEL_BASE* m_currentLabel;
|
||||
wxTextEntry* m_activeTextEntry;
|
||||
SCH_NETNAME_VALIDATOR m_netNameValidator;
|
||||
SCH_LABEL_BASE* m_currentLabel;
|
||||
wxTextEntry* m_activeTextEntry;
|
||||
SCH_NETNAME_VALIDATOR m_netNameValidator;
|
||||
|
||||
FIELDS_GRID_TABLE<SCH_FIELD>* m_fields;
|
||||
std::bitset<64> m_shownColumns;
|
||||
FIELDS_GRID_TABLE* m_fields;
|
||||
std::bitset<64> m_shownColumns;
|
||||
|
||||
UNIT_BINDER m_textSize;
|
||||
UNIT_BINDER m_textSize;
|
||||
|
||||
HTML_MESSAGE_BOX* m_helpWindow;
|
||||
HTML_MESSAGE_BOX* m_helpWindow;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
|
||||
{
|
||||
// Give a bit more room for combobox editors
|
||||
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
|
||||
m_fields = new FIELDS_GRID_TABLE<LIB_FIELD>( this, aParent, m_grid, m_libEntry );
|
||||
m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_libEntry );
|
||||
m_grid->SetTable( m_fields );
|
||||
m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this,
|
||||
[&]( wxCommandEvent& aEvent )
|
||||
@ -256,7 +256,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
|
||||
// Check for missing field names.
|
||||
for( int ii = MANDATORY_FIELDS; ii < (int) m_fields->size(); ++ii )
|
||||
{
|
||||
LIB_FIELD& field = m_fields->at( ii );
|
||||
SCH_FIELD& field = m_fields->at( ii );
|
||||
wxString fieldName = field.GetName( false );
|
||||
|
||||
if( fieldName.IsEmpty() && !field.GetText().IsEmpty() )
|
||||
@ -359,7 +359,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||
|
||||
for( int ii = m_fields->GetNumberRows() - 1; ii >= MANDATORY_FIELDS; ii-- )
|
||||
{
|
||||
LIB_FIELD& field = m_fields->at( ii );
|
||||
SCH_FIELD& field = m_fields->at( ii );
|
||||
const wxString& fieldName = field.GetCanonicalName();
|
||||
|
||||
if( fieldName.IsEmpty() && field.GetText().IsEmpty() )
|
||||
@ -512,7 +512,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
|
||||
|
||||
SYMBOL_EDITOR_SETTINGS* settings = m_Parent->GetSettings();
|
||||
int fieldID = (int) m_fields->size();
|
||||
LIB_FIELD newField( m_libEntry, fieldID );
|
||||
SCH_FIELD newField( m_libEntry, fieldID );
|
||||
|
||||
newField.SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
|
||||
schIUScale.MilsToIU( settings->m_Defaults.text_size ) ) );
|
||||
@ -587,7 +587,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveUp( wxCommandEvent& event )
|
||||
|
||||
if( i > MANDATORY_FIELDS )
|
||||
{
|
||||
LIB_FIELD tmp = m_fields->at( (unsigned) i );
|
||||
SCH_FIELD tmp = m_fields->at( (unsigned) i );
|
||||
m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
|
||||
m_fields->insert( m_fields->begin() + i - 1, tmp );
|
||||
m_grid->ForceRefresh();
|
||||
@ -613,7 +613,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveDown( wxCommandEvent& event )
|
||||
|
||||
if( i >= MANDATORY_FIELDS && i + 1 < m_fields->GetNumberRows() )
|
||||
{
|
||||
LIB_FIELD tmp = m_fields->at( (unsigned) i );
|
||||
SCH_FIELD tmp = m_fields->at( (unsigned) i );
|
||||
m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
|
||||
m_fields->insert( m_fields->begin() + i + 1, tmp );
|
||||
m_grid->ForceRefresh();
|
||||
@ -635,9 +635,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
|
||||
if( !m_grid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
std::vector<LIB_FIELD> fields;
|
||||
std::vector<SCH_FIELD> fields;
|
||||
|
||||
for( const LIB_FIELD& field : *m_fields )
|
||||
for( const SCH_FIELD& field : *m_fields )
|
||||
fields.emplace_back( field );
|
||||
|
||||
DIALOG_SIM_MODEL dialog( this, m_parentFrame, *m_libEntry, fields );
|
||||
@ -646,11 +646,11 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
|
||||
return;
|
||||
|
||||
// Add in any new fields
|
||||
for( const LIB_FIELD& editedField : fields )
|
||||
for( const SCH_FIELD& editedField : fields )
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for( LIB_FIELD& existingField : *m_fields )
|
||||
for( SCH_FIELD& existingField : *m_fields )
|
||||
{
|
||||
if( existingField.GetName() == editedField.GetName() )
|
||||
{
|
||||
@ -671,10 +671,10 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
|
||||
// Remove any deleted fields
|
||||
for( int ii = (int) m_fields->size() - 1; ii >= 0; --ii )
|
||||
{
|
||||
LIB_FIELD& existingField = m_fields->at( ii );
|
||||
SCH_FIELD& existingField = m_fields->at( ii );
|
||||
bool found = false;
|
||||
|
||||
for( LIB_FIELD& editedField : fields )
|
||||
for( SCH_FIELD& editedField : fields )
|
||||
{
|
||||
if( editedField.GetName() == existingField.GetName() )
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
SYMBOL_EDIT_FRAME* m_Parent;
|
||||
LIB_SYMBOL* m_libEntry;
|
||||
|
||||
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
|
||||
FIELDS_GRID_TABLE* m_fields;
|
||||
|
||||
UNIT_BINDER m_pinNameOffset;
|
||||
|
||||
|
@ -57,7 +57,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
|
||||
m_dummySheetNameField( VECTOR2I( -1, -1 ), SHEETNAME, &m_dummySheet )
|
||||
{
|
||||
m_sheet = aSheet;
|
||||
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_grid, m_sheet );
|
||||
m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_sheet );
|
||||
m_delayedFocusRow = SHEETNAME;
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
|
||||
@ -246,7 +246,7 @@ static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b )
|
||||
}
|
||||
|
||||
|
||||
static bool positioningChanged( FIELDS_GRID_TABLE<SCH_FIELD>* a, std::vector<SCH_FIELD>& b )
|
||||
static bool positioningChanged( FIELDS_GRID_TABLE* a, std::vector<SCH_FIELD>& b )
|
||||
{
|
||||
for( size_t i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
|
||||
{
|
||||
|
@ -64,21 +64,21 @@ private:
|
||||
void AdjustGridColumns();
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
SCH_SHEET* m_sheet;
|
||||
bool* m_clearAnnotationNewItems;
|
||||
bool* m_updateHierarchyNavigator;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
SCH_SHEET* m_sheet;
|
||||
bool* m_clearAnnotationNewItems;
|
||||
bool* m_updateHierarchyNavigator;
|
||||
|
||||
wxSize m_size;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
std::bitset<64> m_shownColumns;
|
||||
wxSize m_size;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
std::bitset<64> m_shownColumns;
|
||||
|
||||
FIELDS_GRID_TABLE<SCH_FIELD>* m_fields;
|
||||
UNIT_BINDER m_borderWidth;
|
||||
FIELDS_GRID_TABLE* m_fields;
|
||||
UNIT_BINDER m_borderWidth;
|
||||
|
||||
SCH_SHEET m_dummySheet;
|
||||
SCH_FIELD m_dummySheetNameField;
|
||||
SCH_SHEET m_dummySheet;
|
||||
SCH_FIELD m_dummySheetNameField;
|
||||
};
|
||||
|
||||
#endif // DIALOG_SHEET_PROPERTIES_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2022 Mikolaj Wielgus
|
||||
* Copyright (C) 2022 CERN
|
||||
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -27,7 +27,6 @@
|
||||
#include <dialog_sim_model.h>
|
||||
#include <sim/sim_property.h>
|
||||
#include <sim/sim_library_kibis.h>
|
||||
#include <sim/sim_library_spice.h>
|
||||
#include <sim/sim_model.h>
|
||||
#include <sim/sim_model_kibis.h>
|
||||
#include <sim/sim_model_raw_spice.h>
|
||||
@ -41,7 +40,6 @@
|
||||
#include <string_utils.h>
|
||||
#include <locale_io.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/textfile.h>
|
||||
#include <fmt/format.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sim/sim_model_l_mutual.h>
|
||||
@ -61,10 +59,9 @@ bool equivalent( SIM_MODEL::DEVICE_T a, SIM_MODEL::DEVICE_T b )
|
||||
};
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame,
|
||||
T_symbol& aSymbol,
|
||||
std::vector<T_field>& aFields ) :
|
||||
template <typename T>
|
||||
DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame, T& aSymbol,
|
||||
std::vector<SCH_FIELD>& aFields ) :
|
||||
DIALOG_SIM_MODEL_BASE( aParent ),
|
||||
m_frame( aFrame ),
|
||||
m_symbol( aSymbol ),
|
||||
@ -140,8 +137,8 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BA
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
DIALOG_SIM_MODEL<T_symbol, T_field>::~DIALOG_SIM_MODEL()
|
||||
template <typename T>
|
||||
DIALOG_SIM_MODEL<T>::~DIALOG_SIM_MODEL()
|
||||
{
|
||||
// Disable all properties. This is necessary because some of their methods are called after
|
||||
// destruction of DIALOG_SIM_MODEL, oddly. When disabled, they never access their models.
|
||||
@ -163,8 +160,8 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::~DIALOG_SIM_MODEL()
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||
template <typename T>
|
||||
bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
|
||||
{
|
||||
wxCommandEvent dummyEvent;
|
||||
wxString deviceType;
|
||||
@ -179,7 +176,7 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||
auto setFieldValue =
|
||||
[&]( const wxString& aFieldName, const wxString& aValue )
|
||||
{
|
||||
for( T_field& field : m_fields )
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
if( field.GetName() == aFieldName )
|
||||
{
|
||||
@ -343,8 +340,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataFromWindow()
|
||||
template <typename T>
|
||||
bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
|
||||
{
|
||||
m_pinAssignmentsGrid->CommitPendingChanges();
|
||||
m_paramGrid->GetGrid()->CommitChangesFromEditor();
|
||||
@ -424,8 +421,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updateWidgets()
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateWidgets()
|
||||
{
|
||||
// always enable the library browser button -- it makes for fewer clicks if the user has a
|
||||
// whole bunch of inferred passives that they want to specify library models for
|
||||
@ -474,8 +471,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateWidgets()
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updateIbisWidgets( SIM_MODEL* aModel )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateIbisWidgets( SIM_MODEL* aModel )
|
||||
{
|
||||
SIM_MODEL_KIBIS* modelkibis = isIbisLoaded() ? dynamic_cast<SIM_MODEL_KIBIS*>( aModel )
|
||||
: nullptr;
|
||||
@ -518,8 +515,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateIbisWidgets( SIM_MODEL* aModel )
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updateBuiltinModelWidgets( SIM_MODEL* aModel )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateBuiltinModelWidgets( SIM_MODEL* aModel )
|
||||
{
|
||||
// Change the Type choice to match the current device type.
|
||||
if( aModel != m_prevModel )
|
||||
@ -592,8 +589,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateBuiltinModelWidgets( SIM_MODEL*
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updateModelParamsTab( SIM_MODEL* aModel )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateModelParamsTab( SIM_MODEL* aModel )
|
||||
{
|
||||
if( aModel != m_prevModel )
|
||||
{
|
||||
@ -689,8 +686,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateModelParamsTab( SIM_MODEL* aMode
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updateModelCodeTab( SIM_MODEL* aModel )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateModelCodeTab( SIM_MODEL* aModel )
|
||||
{
|
||||
if( dynamic_cast<SIM_MODEL_SPICE_FALLBACK*>( aModel ) )
|
||||
return;
|
||||
@ -710,9 +707,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateModelCodeTab( SIM_MODEL* aModel
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::updatePinAssignments( SIM_MODEL* aModel,
|
||||
bool aForceUpdatePins )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updatePinAssignments( SIM_MODEL* aModel, bool aForceUpdatePins )
|
||||
{
|
||||
if( m_pinAssignmentsGrid->GetNumberRows() == 0 )
|
||||
{
|
||||
@ -795,8 +791,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updatePinAssignments( SIM_MODEL* aMode
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::removeOrphanedPinAssignments( SIM_MODEL* aModel )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::removeOrphanedPinAssignments( SIM_MODEL* aModel )
|
||||
{
|
||||
for( int i = 0; i < aModel->GetPinCount(); ++i )
|
||||
{
|
||||
@ -806,9 +802,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::removeOrphanedPinAssignments( SIM_MODE
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
bool DIALOG_SIM_MODEL<T_symbol, T_field>::loadLibrary( const wxString& aLibraryPath,
|
||||
bool aForceReload )
|
||||
template <typename T>
|
||||
bool DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aLibraryPath, bool aForceReload )
|
||||
{
|
||||
if( m_prevLibrary == aLibraryPath && !aForceReload )
|
||||
return true;
|
||||
@ -863,9 +858,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::loadLibrary( const wxString& aLibraryP
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::addParamPropertyIfRelevant( SIM_MODEL* aModel,
|
||||
int aParamIndex )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::addParamPropertyIfRelevant( SIM_MODEL* aModel, int aParamIndex )
|
||||
{
|
||||
if( aModel->GetParam( aParamIndex ).info.dir == SIM_MODEL::PARAM::DIR_OUT )
|
||||
return;
|
||||
@ -943,9 +937,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::addParamPropertyIfRelevant( SIM_MODEL*
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
wxPGProperty* DIALOG_SIM_MODEL<T_symbol, T_field>::newParamProperty( SIM_MODEL* aModel ,
|
||||
int aParamIndex ) const
|
||||
template <typename T>
|
||||
wxPGProperty* DIALOG_SIM_MODEL<T>::newParamProperty( SIM_MODEL* aModel, int aParamIndex ) const
|
||||
{
|
||||
const SIM_MODEL::PARAM& param = aModel->GetParam( aParamIndex );
|
||||
wxString paramDescription;
|
||||
@ -1066,8 +1059,8 @@ wxPGProperty* DIALOG_SIM_MODEL<T_symbol, T_field>::newParamProperty( SIM_MODEL*
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
int DIALOG_SIM_MODEL<T_symbol, T_field>::findSymbolPinRow( const wxString& aSymbolPinNumber ) const
|
||||
template <typename T>
|
||||
int DIALOG_SIM_MODEL<T>::findSymbolPinRow( const wxString& aSymbolPinNumber ) const
|
||||
{
|
||||
for( int row = 0; row < static_cast<int>( m_sortedPartPins.size() ); ++row )
|
||||
{
|
||||
@ -1081,8 +1074,8 @@ int DIALOG_SIM_MODEL<T_symbol, T_field>::findSymbolPinRow( const wxString& aSymb
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
SIM_MODEL& DIALOG_SIM_MODEL<T_symbol, T_field>::curModel() const
|
||||
template <typename T>
|
||||
SIM_MODEL& DIALOG_SIM_MODEL<T>::curModel() const
|
||||
{
|
||||
if( m_rbLibraryModel->GetValue() )
|
||||
{
|
||||
@ -1101,8 +1094,8 @@ SIM_MODEL& DIALOG_SIM_MODEL<T_symbol, T_field>::curModel() const
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
const SIM_LIBRARY* DIALOG_SIM_MODEL<T_symbol, T_field>::library() const
|
||||
template <typename T>
|
||||
const SIM_LIBRARY* DIALOG_SIM_MODEL<T>::library() const
|
||||
{
|
||||
if( m_libraryModelsMgr.GetLibraries().size() == 1 )
|
||||
return &m_libraryModelsMgr.GetLibraries().begin()->second.get();
|
||||
@ -1111,8 +1104,8 @@ const SIM_LIBRARY* DIALOG_SIM_MODEL<T_symbol, T_field>::library() const
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
wxString DIALOG_SIM_MODEL<T_symbol, T_field>::getSymbolPinString( int symbolPinIndex ) const
|
||||
template <typename T>
|
||||
wxString DIALOG_SIM_MODEL<T>::getSymbolPinString( int symbolPinIndex ) const
|
||||
{
|
||||
LIB_PIN* pin = m_sortedPartPins.at( symbolPinIndex );
|
||||
wxString pinNumber;
|
||||
@ -1131,9 +1124,8 @@ wxString DIALOG_SIM_MODEL<T_symbol, T_field>::getSymbolPinString( int symbolPinI
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
wxString DIALOG_SIM_MODEL<T_symbol, T_field>::getModelPinString( SIM_MODEL* aModel,
|
||||
int aModelPinIndex ) const
|
||||
template <typename T>
|
||||
wxString DIALOG_SIM_MODEL<T>::getModelPinString( SIM_MODEL* aModel, int aModelPinIndex ) const
|
||||
{
|
||||
const wxString& pinName = aModel->GetPin( aModelPinIndex ).name;
|
||||
|
||||
@ -1148,8 +1140,8 @@ wxString DIALOG_SIM_MODEL<T_symbol, T_field>::getModelPinString( SIM_MODEL* aMod
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
int DIALOG_SIM_MODEL<T_symbol, T_field>::getModelPinIndex( const wxString& aModelPinString ) const
|
||||
template <typename T>
|
||||
int DIALOG_SIM_MODEL<T>::getModelPinIndex( const wxString& aModelPinString ) const
|
||||
{
|
||||
if( aModelPinString == "Not Connected" )
|
||||
return SIM_MODEL::PIN::NOT_CONNECTED;
|
||||
@ -1166,24 +1158,24 @@ int DIALOG_SIM_MODEL<T_symbol, T_field>::getModelPinIndex( const wxString& aMode
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onRadioButton( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onRadioButton( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_prevModel = nullptr; // Ensure the Model panel will be rebuild after updating other params.
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onLibrarayPathText( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onLibrarayPathText( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_rbLibraryModel->SetValue( true );
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onLibraryPathTextEnter( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onLibraryPathTextEnter( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_rbLibraryModel->GetValue() )
|
||||
{
|
||||
@ -1205,8 +1197,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onLibraryPathTextEnter( wxCommandEvent
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onLibraryPathTextKillFocus( wxFocusEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onLibraryPathTextKillFocus( wxFocusEvent& aEvent )
|
||||
{
|
||||
if( !m_inKillFocus )
|
||||
{
|
||||
@ -1220,8 +1212,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onLibraryPathTextKillFocus( wxFocusEve
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onBrowseButtonClick( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onBrowseButtonClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
static wxString s_mruPath;
|
||||
|
||||
@ -1246,8 +1238,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onBrowseButtonClick( wxCommandEvent& a
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onModelNameChoice( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onModelNameChoice( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( isIbisLoaded() )
|
||||
{
|
||||
@ -1270,8 +1262,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onModelNameChoice( wxCommandEvent& aEv
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinCombobox( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinCombobox( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxArrayString modelLabels;
|
||||
|
||||
@ -1300,8 +1292,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinCombobox( wxCommandEvent& aEvent
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinComboboxTextEnter( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinComboboxTextEnter( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_pinCombobox->SetSelection( m_pinCombobox->FindString( m_pinCombobox->GetValue() ) );
|
||||
|
||||
@ -1309,21 +1301,21 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinComboboxTextEnter( wxCommandEvent
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinModelCombobox( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinModelCombobox( wxCommandEvent& aEvent )
|
||||
{
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinModelComboboxTextEnter( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinModelComboboxTextEnter( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_pinModelCombobox->SetSelection( m_pinModelCombobox->FindString( m_pinModelCombobox->GetValue() ) );
|
||||
}
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onDifferentialCheckbox( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onDifferentialCheckbox( wxCommandEvent& aEvent )
|
||||
{
|
||||
SIM_MODEL_KIBIS* modelkibis = dynamic_cast<SIM_MODEL_KIBIS*>( &curModel() );
|
||||
|
||||
@ -1336,8 +1328,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onDifferentialCheckbox( wxCommandEvent
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onDeviceTypeChoice( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onDeviceTypeChoice( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_rbBuiltinModel->SetValue( true );
|
||||
|
||||
@ -1354,8 +1346,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onDeviceTypeChoice( wxCommandEvent& aE
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onWaveformChoice( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onWaveformChoice( wxCommandEvent& aEvent )
|
||||
{
|
||||
SIM_MODEL::DEVICE_T deviceType = curModel().GetDeviceType();
|
||||
wxString typeDescription = m_waveformChoice->GetStringSelection();
|
||||
@ -1393,8 +1385,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onWaveformChoice( wxCommandEvent& aEve
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onTypeChoice( wxCommandEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onTypeChoice( wxCommandEvent& aEvent )
|
||||
{
|
||||
SIM_MODEL::DEVICE_T deviceType = curModel().GetDeviceType();
|
||||
wxString typeDescription = m_deviceSubtypeChoice->GetStringSelection();
|
||||
@ -1414,15 +1406,15 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onTypeChoice( wxCommandEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPageChanging( wxBookCtrlEvent& event )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPageChanging( wxBookCtrlEvent& event )
|
||||
{
|
||||
updateModelCodeTab( &curModel() );
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinAssignmentsGridCellChange( wxGridEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinAssignmentsGridCellChange( wxGridEvent& aEvent )
|
||||
{
|
||||
int symbolPinIndex = aEvent.GetRow();
|
||||
wxString oldModelPinName = aEvent.GetString();
|
||||
@ -1446,8 +1438,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinAssignmentsGridCellChange( wxGrid
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinAssignmentsGridSize( wxSizeEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onPinAssignmentsGridSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
wxGridUpdateLocker deferRepaintsTillLeavingScope( m_pinAssignmentsGrid );
|
||||
|
||||
@ -1459,8 +1451,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onPinAssignmentsGridSize( wxSizeEvent&
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSetFocus( wxFocusEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onParamGridSetFocus( wxFocusEvent& aEvent )
|
||||
{
|
||||
// By default, when a property grid is focused, the textbox is not immediately focused until
|
||||
// Tab key is pressed. This is inconvenient, so we fix that here.
|
||||
@ -1483,8 +1475,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSetFocus( wxFocusEvent& aEv
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSelectionChange( wxPropertyGridEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onParamGridSelectionChange( wxPropertyGridEvent& aEvent )
|
||||
{
|
||||
wxPropertyGrid* grid = m_paramGrid->GetGrid();
|
||||
|
||||
@ -1546,8 +1538,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSelectionChange( wxProperty
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onUpdateUI( wxUpdateUIEvent& aEvent )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onUpdateUI( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
// This is currently patched in wxPropertyGrid::ScrollWindow() in the Mac wxWidgets fork.
|
||||
// However, we may need this version if it turns out to be an issue on other platforms and
|
||||
@ -1572,8 +1564,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onUpdateUI( wxUpdateUIEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::adjustParamGridColumns( int aWidth, bool aForce )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::adjustParamGridColumns( int aWidth, bool aForce )
|
||||
{
|
||||
wxPropertyGrid* grid = m_paramGridMgr->GetGrid();
|
||||
int margin = 15;
|
||||
@ -1608,8 +1600,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::adjustParamGridColumns( int aWidth, bo
|
||||
}
|
||||
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::onSizeParamGrid( wxSizeEvent& event )
|
||||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::onSizeParamGrid( wxSizeEvent& event )
|
||||
{
|
||||
adjustParamGridColumns( event.GetSize().GetX(), false );
|
||||
|
||||
@ -1618,5 +1610,5 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onSizeParamGrid( wxSizeEvent& event )
|
||||
|
||||
|
||||
|
||||
template class DIALOG_SIM_MODEL<SCH_SYMBOL, SCH_FIELD>;
|
||||
template class DIALOG_SIM_MODEL<LIB_SYMBOL, LIB_FIELD>;
|
||||
template class DIALOG_SIM_MODEL<SCH_SYMBOL>;
|
||||
template class DIALOG_SIM_MODEL<LIB_SYMBOL>;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 Mikolaj Wielgus
|
||||
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -41,7 +41,7 @@
|
||||
// wxPG_NATIVE_DOUBLE_BUFFERING flag is not set.
|
||||
// 2. wxPropertyGridManager->ShowHeader() segfaults when called from this dialog's constructor.
|
||||
|
||||
template <typename T_symbol, typename T_field>
|
||||
template <typename T>
|
||||
class DIALOG_SIM_MODEL : public DIALOG_SIM_MODEL_BASE
|
||||
{
|
||||
public:
|
||||
@ -61,8 +61,8 @@ public:
|
||||
MODEL
|
||||
};
|
||||
|
||||
DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame, T_symbol& aSymbol,
|
||||
std::vector<T_field>& aFields );
|
||||
DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame, T& aSymbol,
|
||||
std::vector<SCH_FIELD>& aFields );
|
||||
|
||||
~DIALOG_SIM_MODEL();
|
||||
|
||||
@ -121,27 +121,27 @@ private:
|
||||
bool isIbisLoaded() { return dynamic_cast<const SIM_LIBRARY_KIBIS*>( library() ); }
|
||||
|
||||
private:
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
T_symbol& m_symbol;
|
||||
std::vector<T_field>& m_fields;
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
T& m_symbol;
|
||||
std::vector<SCH_FIELD>& m_fields;
|
||||
|
||||
SIM_LIB_MGR m_libraryModelsMgr;
|
||||
SIM_LIB_MGR m_builtinModelsMgr;
|
||||
wxString m_prevLibrary;
|
||||
const SIM_MODEL* m_prevModel;
|
||||
SIM_LIB_MGR m_libraryModelsMgr;
|
||||
SIM_LIB_MGR m_builtinModelsMgr;
|
||||
wxString m_prevLibrary;
|
||||
const SIM_MODEL* m_prevModel;
|
||||
|
||||
std::vector<LIB_PIN*> m_sortedPartPins; //< Pins of the current part.
|
||||
std::map<SIM_MODEL::DEVICE_T, SIM_MODEL::TYPE> m_curModelTypeOfDeviceType;
|
||||
SIM_MODEL::TYPE m_curModelType;
|
||||
|
||||
SCINTILLA_TRICKS* m_scintillaTricksCode;
|
||||
SCINTILLA_TRICKS* m_scintillaTricksSubckt;
|
||||
SCINTILLA_TRICKS* m_scintillaTricksCode;
|
||||
SCINTILLA_TRICKS* m_scintillaTricksSubckt;
|
||||
|
||||
wxPGProperty* m_firstCategory; // Used to add principal parameters to root.
|
||||
wxPGProperty* m_prevParamGridSelection;
|
||||
wxPGProperty* m_firstCategory; // Used to add principal parameters to root.
|
||||
wxPGProperty* m_prevParamGridSelection;
|
||||
|
||||
int m_lastParamGridWidth;
|
||||
bool m_inKillFocus;
|
||||
int m_lastParamGridWidth;
|
||||
bool m_inKillFocus;
|
||||
};
|
||||
|
||||
#endif /* DIALOG_SIM_MODEL_H */
|
||||
|
@ -356,7 +356,7 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
// so we need to handle m_part == nullptr
|
||||
// wxASSERT( m_part );
|
||||
|
||||
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_fieldsGrid, m_symbol );
|
||||
m_fields = new FIELDS_GRID_TABLE( this, aParent, m_fieldsGrid, m_symbol );
|
||||
|
||||
// Give a bit more room for combobox editors
|
||||
m_fieldsGrid->SetDefaultRowSize( m_fieldsGrid->GetDefaultRowSize() + 4 );
|
||||
|
@ -99,18 +99,18 @@ private:
|
||||
virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) override;
|
||||
|
||||
private:
|
||||
SCH_SYMBOL* m_symbol;
|
||||
LIB_SYMBOL* m_part;
|
||||
SCH_SYMBOL* m_symbol;
|
||||
LIB_SYMBOL* m_part;
|
||||
|
||||
wxSize m_fieldsSize;
|
||||
wxSize m_lastRequestedFieldsSize;
|
||||
wxSize m_pinsSize;
|
||||
wxSize m_lastRequestedPinsSize;
|
||||
bool m_editorShown;
|
||||
std::bitset<64> m_shownColumns;
|
||||
wxSize m_fieldsSize;
|
||||
wxSize m_lastRequestedFieldsSize;
|
||||
wxSize m_pinsSize;
|
||||
wxSize m_lastRequestedPinsSize;
|
||||
bool m_editorShown;
|
||||
std::bitset<64> m_shownColumns;
|
||||
|
||||
FIELDS_GRID_TABLE<SCH_FIELD>* m_fields;
|
||||
SCH_PIN_TABLE_DATA_MODEL* m_dataModel;
|
||||
FIELDS_GRID_TABLE* m_fields;
|
||||
SCH_PIN_TABLE_DATA_MODEL* m_dataModel;
|
||||
};
|
||||
|
||||
#endif // DIALOG_SYMBOL_PROPERTIES_H
|
||||
|
@ -82,7 +82,7 @@ DIALOG_UPDATE_SYMBOL_FIELDS::~DIALOG_UPDATE_SYMBOL_FIELDS()
|
||||
void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
|
||||
{
|
||||
// Load non-mandatory fields from the parent part
|
||||
std::vector<LIB_FIELD*> libFields;
|
||||
std::vector<SCH_FIELD*> libFields;
|
||||
std::set<wxString> fieldNames;
|
||||
std::unique_ptr<LIB_SYMBOL> flattenedParent = m_symbol->GetParent().lock()->Flatten();
|
||||
|
||||
@ -143,14 +143,14 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
bool resetEffects = m_resetFieldEffects->GetValue();
|
||||
bool resetPositions = m_resetFieldPositions->GetValue();
|
||||
|
||||
std::vector<LIB_FIELD> fields;
|
||||
std::vector<LIB_FIELD> result;
|
||||
std::vector<SCH_FIELD> fields;
|
||||
std::vector<SCH_FIELD> result;
|
||||
m_symbol->GetFields( fields );
|
||||
|
||||
for( LIB_FIELD& field : fields )
|
||||
for( SCH_FIELD& field : fields )
|
||||
{
|
||||
bool copy = true;
|
||||
LIB_FIELD* parentField = nullptr;
|
||||
SCH_FIELD* parentField = nullptr;
|
||||
|
||||
if( alg::contains( m_updateFields, field.GetName() ) )
|
||||
{
|
||||
@ -195,12 +195,12 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
result.emplace_back( std::move( field ) );
|
||||
}
|
||||
|
||||
std::vector<LIB_FIELD*> parentFields;
|
||||
std::vector<SCH_FIELD*> parentFields;
|
||||
int idx = result.size();
|
||||
|
||||
flattenedParent->GetFields( parentFields );
|
||||
|
||||
for( LIB_FIELD* parentField : parentFields )
|
||||
for( SCH_FIELD* parentField : parentFields )
|
||||
{
|
||||
if( !alg::contains( m_updateFields, parentField->GetName() ) )
|
||||
continue;
|
||||
@ -208,7 +208,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
if( !m_symbol->FindField( parentField->GetName() ) )
|
||||
{
|
||||
result.emplace_back( m_symbol, idx++ );
|
||||
LIB_FIELD* newField = &result.back();
|
||||
SCH_FIELD* newField = &result.back();
|
||||
|
||||
newField->SetName( parentField->GetCanonicalName() );
|
||||
newField->SetText( parentField->GetText() );
|
||||
|
@ -359,13 +359,13 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||
LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
|
||||
VECTOR2I p( 2625, -1600 );
|
||||
|
||||
LIB_FIELD& ref = symbol->GetReferenceField();
|
||||
SCH_FIELD& ref = symbol->GetReferenceField();
|
||||
|
||||
ref.SetText( wxT( "U1" ) );
|
||||
ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) );
|
||||
ref.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
|
||||
LIB_FIELD& value = symbol->GetValueField();
|
||||
SCH_FIELD& value = symbol->GetValueField();
|
||||
|
||||
value.SetText( wxT( "OPA604" ) );
|
||||
value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) );
|
||||
|
@ -126,9 +126,8 @@ static wxString netList( LIB_SYMBOL* aSymbol )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame,
|
||||
WX_GRID* aGrid, LIB_SYMBOL* aSymbol ) :
|
||||
FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
||||
LIB_SYMBOL* aSymbol ) :
|
||||
m_frame( aFrame ),
|
||||
m_dialog( aDialog ),
|
||||
m_grid( aGrid ),
|
||||
@ -147,9 +146,8 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame,
|
||||
WX_GRID* aGrid, SCH_SYMBOL* aSymbol ) :
|
||||
FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame, WX_GRID* aGrid,
|
||||
SCH_SYMBOL* aSymbol ) :
|
||||
m_frame( aFrame ),
|
||||
m_dialog( aDialog ),
|
||||
m_grid( aGrid ),
|
||||
@ -168,9 +166,8 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame,
|
||||
WX_GRID* aGrid, SCH_SHEET* aSheet ) :
|
||||
FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame, WX_GRID* aGrid,
|
||||
SCH_SHEET* aSheet ) :
|
||||
m_frame( aFrame ),
|
||||
m_dialog( aDialog ),
|
||||
m_grid( aGrid ),
|
||||
@ -188,9 +185,8 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame,
|
||||
WX_GRID* aGrid, SCH_LABEL_BASE* aLabel ) :
|
||||
FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame, WX_GRID* aGrid,
|
||||
SCH_LABEL_BASE* aLabel ) :
|
||||
m_frame( aFrame ),
|
||||
m_dialog( aDialog ),
|
||||
m_grid( aGrid ),
|
||||
@ -208,8 +204,7 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* a
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
||||
void FIELDS_GRID_TABLE::initGrid( WX_GRID* aGrid )
|
||||
{
|
||||
// Build the various grid cell attributes.
|
||||
// NOTE: validators and cellAttrs are member variables to get the destruction order
|
||||
@ -230,7 +225,13 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
||||
|
||||
m_valueAttr = new wxGridCellAttr;
|
||||
|
||||
if constexpr ( std::is_same_v<T, SCH_FIELD> )
|
||||
if( m_parentType == LIB_SYMBOL_T )
|
||||
{
|
||||
GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
|
||||
valueEditor->SetValidator( m_valueValidator );
|
||||
m_valueAttr->SetEditor( valueEditor );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRID_CELL_STC_EDITOR* valueEditor = new GRID_CELL_STC_EDITOR( true,
|
||||
[this]( wxStyledTextEvent& aEvent, SCINTILLA_TRICKS* aScintillaTricks )
|
||||
@ -240,12 +241,6 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
||||
} );
|
||||
m_valueAttr->SetEditor( valueEditor );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRID_CELL_TEXT_EDITOR* valueEditor = new GRID_CELL_TEXT_EDITOR();
|
||||
valueEditor->SetValidator( m_valueValidator );
|
||||
m_valueAttr->SetEditor( valueEditor );
|
||||
}
|
||||
|
||||
m_footprintAttr = new wxGridCellAttr;
|
||||
GRID_CELL_FPID_EDITOR* fpIdEditor = new GRID_CELL_FPID_EDITOR( m_dialog, m_symbolNetlist );
|
||||
@ -341,12 +336,11 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
||||
|
||||
m_eval = std::make_unique<NUMERIC_EVALUATOR>( m_frame->GetUserUnits() );
|
||||
|
||||
m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE<T>::onUnitsChanged, this );
|
||||
m_frame->Bind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
FIELDS_GRID_TABLE<T>::~FIELDS_GRID_TABLE()
|
||||
FIELDS_GRID_TABLE::~FIELDS_GRID_TABLE()
|
||||
{
|
||||
m_readOnlyAttr->DecRef();
|
||||
m_fieldNameAttr->DecRef();
|
||||
@ -364,12 +358,11 @@ FIELDS_GRID_TABLE<T>::~FIELDS_GRID_TABLE()
|
||||
m_fontAttr->DecRef();
|
||||
m_colorAttr->DecRef();
|
||||
|
||||
m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE<T>::onUnitsChanged, this );
|
||||
m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &FIELDS_GRID_TABLE::onUnitsChanged, this );
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void FIELDS_GRID_TABLE<T>::onUnitsChanged( wxCommandEvent& aEvent )
|
||||
void FIELDS_GRID_TABLE::onUnitsChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( GetView() )
|
||||
GetView()->ForceRefresh();
|
||||
@ -378,8 +371,7 @@ void FIELDS_GRID_TABLE<T>::onUnitsChanged( wxCommandEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
wxString FIELDS_GRID_TABLE<T>::GetColLabelValue( int aCol )
|
||||
wxString FIELDS_GRID_TABLE::GetColLabelValue( int aCol )
|
||||
{
|
||||
switch( aCol )
|
||||
{
|
||||
@ -403,8 +395,7 @@ wxString FIELDS_GRID_TABLE<T>::GetColLabelValue( int aCol )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
bool FIELDS_GRID_TABLE<T>::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
bool FIELDS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
{
|
||||
switch( aCol )
|
||||
{
|
||||
@ -434,15 +425,13 @@ bool FIELDS_GRID_TABLE<T>::CanGetValueAs( int aRow, int aCol, const wxString& aT
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
bool FIELDS_GRID_TABLE<T>::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
bool FIELDS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
{
|
||||
return CanGetValueAs( aRow, aCol, aTypeName );
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind )
|
||||
wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind )
|
||||
{
|
||||
wxGridCellAttr* tmp;
|
||||
|
||||
@ -570,13 +559,12 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||
wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol )
|
||||
{
|
||||
wxCHECK( aRow < GetNumberRows(), wxEmptyString );
|
||||
|
||||
wxGrid* grid = GetView();
|
||||
const T& field = this->at( (size_t) aRow );
|
||||
wxGrid* grid = GetView();
|
||||
const SCH_FIELD& field = this->at( (size_t) aRow );
|
||||
|
||||
if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
|
||||
&& grid->IsCellEditControlShown() )
|
||||
@ -690,11 +678,10 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
|
||||
bool FIELDS_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
|
||||
{
|
||||
wxCHECK( aRow < GetNumberRows(), false );
|
||||
const T& field = this->at( (size_t) aRow );
|
||||
const SCH_FIELD& field = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
@ -710,13 +697,12 @@ bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue )
|
||||
void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
|
||||
{
|
||||
wxCHECK( aRow < GetNumberRows(), /*void*/ );
|
||||
T& field = this->at( (size_t) aRow );
|
||||
VECTOR2I pos;
|
||||
wxString value = aValue;
|
||||
SCH_FIELD& field = this->at( (size_t) aRow );
|
||||
VECTOR2I pos;
|
||||
wxString value = aValue;
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
@ -879,11 +865,10 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue )
|
||||
void FIELDS_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
|
||||
{
|
||||
wxCHECK( aRow < GetNumberRows(), /*void*/ );
|
||||
T& field = this->at( (size_t) aRow );
|
||||
SCH_FIELD& field = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
@ -916,12 +901,6 @@ void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue )
|
||||
}
|
||||
|
||||
|
||||
// Explicit Instantiations
|
||||
|
||||
template class FIELDS_GRID_TABLE<SCH_FIELD>;
|
||||
template class FIELDS_GRID_TABLE<LIB_FIELD>;
|
||||
|
||||
|
||||
void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
|
||||
{
|
||||
if( m_grid->GetGridCursorRow() == FOOTPRINT_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE
|
||||
@ -969,8 +948,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue ) const
|
||||
wxString FIELDS_GRID_TABLE::StringFromBool( bool aValue ) const
|
||||
{
|
||||
if( aValue )
|
||||
return wxT( "1" );
|
||||
@ -979,8 +957,7 @@ wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue ) const
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
bool FIELDS_GRID_TABLE<T>::BoolFromString( wxString aValue ) const
|
||||
bool FIELDS_GRID_TABLE::BoolFromString( wxString aValue ) const
|
||||
{
|
||||
if( aValue == wxS( "1" ) )
|
||||
{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#ifndef FIELDS_GRID_TABLE_H
|
||||
#define FIELDS_GRID_TABLE_H
|
||||
|
||||
#include <sch_validators.h>
|
||||
#include <wx/grid.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <grid_tricks.h>
|
||||
@ -45,8 +44,8 @@ public:
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void showPopupMenu( wxMenu& menu, wxGridEvent& aEvent ) override;
|
||||
virtual void doPopupSelection( wxCommandEvent& event ) override;
|
||||
void showPopupMenu( wxMenu& menu, wxGridEvent& aEvent ) override;
|
||||
void doPopupSelection( wxCommandEvent& event ) override;
|
||||
DIALOG_SHIM* m_dlg;
|
||||
};
|
||||
|
||||
@ -73,8 +72,7 @@ enum FIELDS_DATA_COL_ORDER
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class FIELDS_GRID_TABLE : public wxGridTableBase, public std::vector<T>
|
||||
class FIELDS_GRID_TABLE : public wxGridTableBase, public std::vector<SCH_FIELD>
|
||||
{
|
||||
public:
|
||||
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
||||
@ -85,7 +83,7 @@ public:
|
||||
SCH_SHEET* aSheet );
|
||||
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_EDIT_FRAME* aFrame, WX_GRID* aGrid,
|
||||
SCH_LABEL_BASE* aLabel );
|
||||
~FIELDS_GRID_TABLE();
|
||||
~FIELDS_GRID_TABLE() override;
|
||||
|
||||
int GetNumberRows() override { return (int) this->size(); }
|
||||
int GetNumberCols() override { return FDC_COUNT; }
|
||||
|
@ -161,7 +161,7 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
wxString GetHtmlFieldRow( const LIB_FIELD& aField ) const
|
||||
wxString GetHtmlFieldRow( const SCH_FIELD& aField ) const
|
||||
{
|
||||
wxString name = aField.GetCanonicalName();
|
||||
wxString text;
|
||||
@ -214,11 +214,11 @@ protected:
|
||||
void SetHtmlFieldTable()
|
||||
{
|
||||
wxString fieldtable;
|
||||
std::vector<LIB_FIELD*> fields;
|
||||
std::vector<SCH_FIELD*> fields;
|
||||
|
||||
m_symbol->GetFields( fields );
|
||||
|
||||
for( const LIB_FIELD* field: fields )
|
||||
for( const SCH_FIELD* field: fields )
|
||||
fieldtable += GetHtmlFieldRow( *field );
|
||||
|
||||
if( m_symbol->IsAlias() )
|
||||
@ -228,11 +228,11 @@ protected:
|
||||
// Append all of the unique parent fields if this is an alias.
|
||||
if( parent )
|
||||
{
|
||||
std::vector<LIB_FIELD*> parentFields;
|
||||
std::vector<SCH_FIELD*> parentFields;
|
||||
|
||||
parent->GetFields( parentFields );
|
||||
|
||||
for( const LIB_FIELD* parentField : parentFields )
|
||||
for( const SCH_FIELD* parentField : parentFields )
|
||||
{
|
||||
if( m_symbol->FindField( parentField->GetCanonicalName() ) )
|
||||
continue;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user