Direct editing of LIB_FIELDs and SCH_FIELDs in dialogs.

Fixes: lp:1676178
* https://bugs.launchpad.net/kicad/+bug/1676178

Fixes: lp:1749220
* https://bugs.launchpad.net/kicad/+bug/1749220

Fixes: lp:1779557
* https://bugs.launchpad.net/kicad/+bug/1779557

Fixes: lp:1425134
* https://bugs.launchpad.net/kicad/+bug/1425134

Fixes: lp:1565195
* https://bugs.launchpad.net/kicad/+bug/1565195

(cherry picked from commit b6aee79)
This commit is contained in:
Jeff Young 2018-02-28 16:54:35 +00:00
parent bcd9a7745d
commit c8b02674dc
13 changed files with 3369 additions and 7624 deletions

View File

@ -120,6 +120,7 @@ set( EESCHEMA_SRCS
eeschema_config.cpp
erc.cpp
events_called_functions_for_edit.cpp
fields_grid_table.cpp
files-io.cpp
find.cpp
generate_alias_info.cpp

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -16,293 +16,209 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* upperSizer;
upperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbFields;
sbFields = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxVERTICAL );
wxStaticBoxSizer* optionsSizer;
optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_grid = new wxGrid( sbFields->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnit = new wxStaticText( optionsSizer->GetStaticBox(), wxID_ANY, _("Unit:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnit->Wrap( -1 );
optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
// Grid
m_grid->CreateGrid( 4, 11 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
wxArrayString unitChoiceChoices;
unitChoice = new wxChoice( optionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
// Columns
m_grid->SetColSize( 0, 72 );
m_grid->SetColSize( 1, 120 );
m_grid->SetColSize( 2, 48 );
m_grid->SetColSize( 3, 72 );
m_grid->SetColSize( 4, 72 );
m_grid->SetColSize( 5, 48 );
m_grid->SetColSize( 6, 48 );
m_grid->SetColSize( 7, 84 );
m_grid->SetColSize( 8, 84 );
m_grid->SetColSize( 9, 84 );
m_grid->SetColSize( 10, 84 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Name") );
m_grid->SetColLabelValue( 1, _("Value") );
m_grid->SetColLabelValue( 2, _("Show") );
m_grid->SetColLabelValue( 3, _("H Align") );
m_grid->SetColLabelValue( 4, _("V Align") );
m_grid->SetColLabelValue( 5, _("Italic") );
m_grid->SetColLabelValue( 6, _("Bold") );
m_grid->SetColLabelValue( 7, _("Text Size") );
m_grid->SetColLabelValue( 8, _("Orientation") );
m_grid->SetColLabelValue( 9, _("X Position") );
m_grid->SetColLabelValue( 10, _("Y Position") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
wxBoxSizer* bSizerUnitsInterchangeable;
bSizerUnitsInterchangeable = new wxBoxSizer( wxHORIZONTAL );
// Rows
m_grid->EnableDragRowSize( true );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
unitsInterchageableText = new wxStaticText( optionsSizer->GetStaticBox(), wxID_ANY, _("Interchangeable units:"), wxDefaultPosition, wxDefaultSize, 0 );
unitsInterchageableText->Wrap( -1 );
bSizerUnitsInterchangeable->Add( unitsInterchageableText, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
// Label Appearance
unitsInterchageableLabel = new wxStaticText( optionsSizer->GetStaticBox(), wxID_ANY, _("Yes"), wxDefaultPosition, wxDefaultSize, 0 );
unitsInterchageableLabel->Wrap( -1 );
bSizerUnitsInterchangeable->Add( unitsInterchageableLabel, 0, wxALL, 5 );
// Cell Defaults
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetMinSize( wxSize( -1,180 ) );
sbFields->Add( m_grid, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bButtonSize;
bButtonSize = new wxBoxSizer( wxHORIZONTAL );
m_bpAdd = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpAdd->SetMinSize( wxSize( 30,30 ) );
bButtonSize->Add( m_bpAdd, 0, 0, 5 );
m_bpDelete = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpDelete->SetMinSize( wxSize( 30,30 ) );
bButtonSize->Add( m_bpDelete, 0, wxRIGHT, 10 );
m_bpMoveUp = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpMoveUp->SetMinSize( wxSize( 30,30 ) );
bButtonSize->Add( m_bpMoveUp, 0, wxLEFT, 10 );
m_bpMoveDown = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpMoveDown->SetMinSize( wxSize( 30,30 ) );
bButtonSize->Add( m_bpMoveDown, 0, wxRIGHT, 5 );
optionsSizer->Add( bSizerUnitsInterchangeable, 0, wxEXPAND, 5 );
bButtonSize->Add( 0, 0, 1, wxEXPAND, 5 );
wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("+180"), _("-90") };
int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString );
orientationRadioBox = new wxRadioBox( optionsSizer->GetStaticBox(), wxID_ANY, _("Orientation (degrees):"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
orientationRadioBox->SetSelection( 0 );
orientationRadioBox->SetToolTip( _("Select if the symbol is to be rotated when drawn") );
m_updateFieldValues = new wxButton( sbFields->GetStaticBox(), wxID_ANY, _(" Update Fields from Library... "), wxDefaultPosition, wxDefaultSize, 0 );
m_updateFieldValues->SetToolTip( _("Sets fields to the original library values") );
optionsSizer->Add( orientationRadioBox, 0, wxEXPAND|wxALL, 5 );
wxString mirrorRadioBoxChoices[] = { _("Default"), _("Mirror around X axis"), _("Mirror around Y axis") };
int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString );
mirrorRadioBox = new wxRadioBox( optionsSizer->GetStaticBox(), wxID_ANY, _("Aspect:"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
mirrorRadioBox->SetSelection( 2 );
mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the symbol") );
optionsSizer->Add( mirrorRadioBox, 0, wxALL|wxEXPAND, 5 );
convertCheckBox = new wxCheckBox( optionsSizer->GetStaticBox(), wxID_ANY, _("Convert shape"), wxDefaultPosition, wxDefaultSize, 0 );
convertCheckBox->SetToolTip( _("Use the alternate shape of this symbol.\nFor gates, this is the \"De Morgan\" conversion") );
optionsSizer->Add( convertCheckBox, 0, wxALL, 5 );
wxStaticBoxSizer* sbSizerChipName;
sbSizerChipName = new wxStaticBoxSizer( new wxStaticBox( optionsSizer->GetStaticBox(), wxID_ANY, _("Library Symbol:") ), wxVERTICAL );
chipnameTextCtrl = new wxTextCtrl( sbSizerChipName->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTextCtrl->SetToolTip( _("Name of the symbol in the library to which this symbol is linked") );
sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* bSizerChpinameButt;
bSizerChpinameButt = new wxBoxSizer( wxHORIZONTAL );
m_buttonTestChipName = new wxButton( sbSizerChipName->GetStaticBox(), wxID_ANY, _("Validate"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChpinameButt->Add( m_buttonTestChipName, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_buttonSelectChipName = new wxButton( sbSizerChipName->GetStaticBox(), wxID_ANY, _("Change"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChpinameButt->Add( m_buttonSelectChipName, 0, wxTOP|wxBOTTOM, 5 );
bButtonSize->Add( m_updateFieldValues, 0, wxALL|wxEXPAND, 5 );
sbSizerChipName->Add( bSizerChpinameButt, 1, wxEXPAND, 5 );
sbFields->Add( bButtonSize, 0, wxEXPAND, 10 );
optionsSizer->Add( sbSizerChipName, 0, wxEXPAND|wxALL, 5 );
mainSizer->Add( sbFields, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_staticTextTimeStamp = new wxStaticText( optionsSizer->GetStaticBox(), wxID_ANY, _("Symbol ID:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTimeStamp->Wrap( -1 );
optionsSizer->Add( m_staticTextTimeStamp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* lowerSizer;
lowerSizer = new wxBoxSizer( wxHORIZONTAL );
m_textCtrlTimeStamp = new wxTextCtrl( optionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
wxStaticBoxSizer* sbSizerLibraryReference;
sbSizerLibraryReference = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 3, 2, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Library Reference:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxBoxSizer* bLibraryReferenceSizer;
bLibraryReferenceSizer = new wxBoxSizer( wxHORIZONTAL );
m_libraryNameTextCtrl = new wxTextCtrl( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_libraryNameTextCtrl->SetToolTip( _("Name of the symbol in the library to which this symbol is linked") );
bLibraryReferenceSizer->Add( m_libraryNameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_buttonBrowseLibrary = new wxBitmapButton( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
bLibraryReferenceSizer->Add( m_buttonBrowseLibrary, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( bLibraryReferenceSizer, 1, wxEXPAND|wxRIGHT, 5 );
m_unitLabel = new wxStaticText( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Unit:"), wxDefaultPosition, wxDefaultSize, 0 );
m_unitLabel->Wrap( -1 );
fgSizer1->Add( m_unitLabel, 0, wxBOTTOM|wxRIGHT, 5 );
wxArrayString m_unitChoiceChoices;
m_unitChoice = new wxChoice( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_unitChoiceChoices, 0 );
m_unitChoice->SetSelection( 0 );
m_unitChoice->SetMinSize( wxSize( 100,-1 ) );
fgSizer1->Add( m_unitChoice, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_cbAlternateSymbol = new wxCheckBox( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbAlternateSymbol->SetToolTip( _("Use the alternate shape of this symbol.\nFor gates, this is the \"De Morgan\" conversion") );
fgSizer1->Add( m_cbAlternateSymbol, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerLibraryReference->Add( fgSizer1, 1, wxEXPAND, 5 );
lowerSizer->Add( sbSizerLibraryReference, 5, wxEXPAND|wxRIGHT|wxLEFT, 10 );
wxString m_rbOrientationChoices[] = { _("0"), _("+90"), _("+180"), _("-90") };
int m_rbOrientationNChoices = sizeof( m_rbOrientationChoices ) / sizeof( wxString );
m_rbOrientation = new wxRadioBox( this, wxID_ANY, _("Orientation"), wxDefaultPosition, wxDefaultSize, m_rbOrientationNChoices, m_rbOrientationChoices, 1, wxRA_SPECIFY_COLS );
m_rbOrientation->SetSelection( 0 );
m_rbOrientation->SetToolTip( _("Select if the symbol is to be rotated when drawn") );
lowerSizer->Add( m_rbOrientation, 2, wxEXPAND|wxRIGHT|wxLEFT, 8 );
wxString m_rbMirrorChoices[] = { _("Default"), _("Mirror around X axis "), _("Mirror around Y axis ") };
int m_rbMirrorNChoices = sizeof( m_rbMirrorChoices ) / sizeof( wxString );
m_rbMirror = new wxRadioBox( this, wxID_ANY, _("Aspect"), wxDefaultPosition, wxDefaultSize, m_rbMirrorNChoices, m_rbMirrorChoices, 1, wxRA_SPECIFY_COLS );
m_rbMirror->SetSelection( 1 );
m_rbMirror->SetToolTip( _("Pick the graphical transformation to be used when displaying the symbol") );
lowerSizer->Add( m_rbMirror, 2, wxEXPAND|wxRIGHT|wxLEFT, 8 );
mainSizer->Add( lowerSizer, 0, wxEXPAND|wxTOP|wxRIGHT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* bSizer101;
bSizer101 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* timeStampLabel;
timeStampLabel = new wxStaticText( this, wxID_ANY, _("Unique ID:"), wxDefaultPosition, wxDefaultSize, 0 );
timeStampLabel->Wrap( -1 );
bSizer11->Add( timeStampLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_textCtrlTimeStamp = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_textCtrlTimeStamp->SetToolTip( _("Unique ID that identifies the symbol") );
optionsSizer->Add( m_textCtrlTimeStamp, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer11->Add( m_textCtrlTimeStamp, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticline1 = new wxStaticLine( optionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
optionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
spiceFieldsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Edit Spice Model"), wxDefaultPosition, wxDefaultSize, 0 );
optionsSizer->Add( spiceFieldsButton, 0, wxALL|wxEXPAND, 5 );
bSizer101->Add( bSizer11, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
resetFieldsStyleButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Reset Field Properties"), wxDefaultPosition, wxDefaultSize, 0 );
resetFieldsStyleButton->SetToolTip( _("Set position and style of fields and symbol orientation to default library value.\nField values are not modified.") );
optionsSizer->Add( resetFieldsStyleButton, 0, wxALL|wxEXPAND, 5 );
bSizer101->Add( 0, 0, 1, wxEXPAND, 5 );
updateFieldValues = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Update Field Values"), wxDefaultPosition, wxDefaultSize, 0 );
updateFieldValues->SetToolTip( _("Sets fields to the original library values") );
m_spiceFieldsButton = new wxButton( this, wxID_ANY, _(" Edit Spice Model... "), wxDefaultPosition, wxDefaultSize, 0 );
bSizer101->Add( m_spiceFieldsButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 20 );
optionsSizer->Add( updateFieldValues, 0, wxALL|wxEXPAND, 5 );
m_stdDialogButtonSizer = new wxStdDialogButtonSizer();
m_stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
m_stdDialogButtonSizer->AddButton( m_stdDialogButtonSizerOK );
m_stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
m_stdDialogButtonSizer->AddButton( m_stdDialogButtonSizerCancel );
m_stdDialogButtonSizer->Realize();
bSizer101->Add( m_stdDialogButtonSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
upperSizer->Add( optionsSizer, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* fieldsSizer;
fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields:") ), wxHORIZONTAL );
wxStaticBoxSizer* gridStaticBoxSizer;
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( gridStaticBoxSizer->GetStaticBox(), wxID_ANY, wxPoint( -1,-1 ), wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
moveUpButton = new wxBitmapButton( gridStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
moveUpButton->SetToolTip( _("Move the selected optional field up one position") );
bSizer9->Add( moveUpButton, 0, wxALL, 5 );
moveDownButton = new wxBitmapButton( gridStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
moveDownButton->SetToolTip( _("Move the selected optional field down one position") );
bSizer9->Add( moveDownButton, 0, wxALL, 5 );
bSizer9->Add( 0, 0, 1, wxEXPAND, 5 );
deleteFieldButton = new wxBitmapButton( gridStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
deleteFieldButton->SetToolTip( _("Delete optional field") );
bSizer9->Add( deleteFieldButton, 0, wxALL, 5 );
addFieldButton = new wxBitmapButton( gridStaticBoxSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
addFieldButton->SetToolTip( _("Create new custom field") );
bSizer9->Add( addFieldButton, 0, wxALL, 5 );
gridStaticBoxSizer->Add( bSizer9, 0, wxEXPAND, 5 );
fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 0 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerJustification;
bSizerJustification = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Horizontal Position:"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 0 );
bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Align top"), _("Align center"), _("Align bottom") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Vertical Position:"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 0 );
bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerJustification, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizerStyle;
bSizerStyle = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Visibility:") ), wxVERTICAL );
showCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Make selected field visible") );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Rotated 90 degrees the selected field") );
visibilitySizer->Add( rotateCheckBox, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerStyle->Add( visibilitySizer, 1, wxEXPAND|wxALL, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold and italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Font Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 3 );
bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("Field Name:"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, wxTOP, 5 );
fieldNameTextCtrl = new wxTextCtrl( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetToolTip( _("Name of the selected field. Fixed field names are not editable") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxBOTTOM|wxEXPAND, 5 );
fieldValueLabel = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("Field Value:"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldValueLabel, 0, wxALIGN_TOP|wxTOP, 5 );
fieldValueTextCtrl = new wxTextCtrl( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetToolTip( _("Name of the selected field. Fixed field names are not editable") );
fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 );
m_show_datasheet_button = new wxButton( fieldsSizer->GetStaticBox(), wxID_ANY, _("Open in Browser"), wxDefaultPosition, wxDefaultSize, 0 );
m_show_datasheet_button->SetToolTip( _("If your datasheet is an http:// link or a complete file path, then it may show in your browser by pressing this button.") );
fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxBOTTOM|wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 6, 0 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("Font size:"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxPoint( -1,-1 ), wxDefaultSize, 0 );
textSizeTextCtrl->SetToolTip( _("Font Size of the selected field") );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxBOTTOM, 0 );
m_staticTextUnitSize = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posXLabel = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxPoint( -1,-1 ), wxDefaultSize, 0 );
posXTextCtrl->SetToolTip( _("X coordinate of the selected field") );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxTOP, 0 );
m_staticTextUnitPosX = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( fieldsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxPoint( -1,-1 ), wxDefaultSize, 0 );
posYTextCtrl->SetToolTip( _("X coordinate of the selected field") );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND, 5 );
m_staticTextUnitPosY = new wxStaticText( fieldsSizer->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP, 5 );
fieldsSizer->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 );
upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( upperSizer, 0, wxEXPAND, 5 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 5 );
mainSizer->Add( bSizer101, 0, wxEXPAND, 5 );
this->SetSizer( mainSizer );
@ -310,44 +226,32 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
mainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnCloseDialog ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnInitDlg ) );
m_buttonTestChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnTestChipName ), NULL, this );
m_buttonSelectChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSelectChipName ), NULL, this );
spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::EditSpiceModel ), NULL, this );
resetFieldsStyleButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::SetInitCmp ), NULL, this );
updateFieldValues->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFields ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnListItemSelected ), NULL, this );
fieldListCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeFieldsList ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveUpButtonHandler ), NULL, this );
moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::deleteFieldButtonHandler ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::addFieldButtonHandler ), NULL, this );
m_show_datasheet_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::showButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnUpdateUI ) );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnDeleteField ), NULL, this );
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveDown ), NULL, this );
m_updateFieldValues->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFieldsFromLibrary ), NULL, this );
m_buttonBrowseLibrary->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnBrowseLibrary ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this );
}
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnCloseDialog ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnInitDlg ) );
m_buttonTestChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnTestChipName ), NULL, this );
m_buttonSelectChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSelectChipName ), NULL, this );
spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::EditSpiceModel ), NULL, this );
resetFieldsStyleButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::SetInitCmp ), NULL, this );
updateFieldValues->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFields ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnListItemSelected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeFieldsList ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveUpButtonHandler ), NULL, this );
moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::deleteFieldButtonHandler ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::addFieldButtonHandler ), NULL, this );
m_show_datasheet_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::showButtonHandler ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnUpdateUI ) );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnDeleteField ), NULL, this );
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnMoveDown ), NULL, this );
m_updateFieldValues->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFieldsFromLibrary ), NULL, this );
m_buttonBrowseLibrary->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnBrowseLibrary ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -12,25 +12,25 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/listctrl.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/radiobox.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -44,67 +44,38 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE : public DIALOG_SHIM
private:
protected:
wxStaticText* m_staticTextUnit;
wxChoice* unitChoice;
wxStaticText* unitsInterchageableText;
wxStaticText* unitsInterchageableLabel;
wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox;
wxCheckBox* convertCheckBox;
wxTextCtrl* chipnameTextCtrl;
wxButton* m_buttonTestChipName;
wxButton* m_buttonSelectChipName;
wxStaticText* m_staticTextTimeStamp;
wxTextCtrl* m_textCtrlTimeStamp;
wxGrid* m_grid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxBitmapButton* m_bpMoveUp;
wxBitmapButton* m_bpMoveDown;
wxButton* m_updateFieldValues;
wxStaticText* m_staticText3;
wxTextCtrl* m_libraryNameTextCtrl;
wxBitmapButton* m_buttonBrowseLibrary;
wxStaticText* m_unitLabel;
wxChoice* m_unitChoice;
wxCheckBox* m_cbAlternateSymbol;
wxRadioBox* m_rbOrientation;
wxRadioBox* m_rbMirror;
wxStaticLine* m_staticline1;
wxButton* spiceFieldsButton;
wxButton* resetFieldsStyleButton;
wxButton* updateFieldValues;
wxListCtrl* fieldListCtrl;
wxBitmapButton* moveUpButton;
wxBitmapButton* moveDownButton;
wxBitmapButton* deleteFieldButton;
wxBitmapButton* addFieldButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxButton* m_show_datasheet_button;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
wxTextCtrl* m_textCtrlTimeStamp;
wxButton* m_spiceFieldsButton;
wxStdDialogButtonSizer* m_stdDialogButtonSizer;
wxButton* m_stdDialogButtonSizerOK;
wxButton* m_stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnTestChipName( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectChipName( wxCommandEvent& event ) { event.Skip(); }
virtual void EditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateFields( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnSizeFieldsList( wxSizeEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void showButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateFieldsFromLibrary( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowseLibrary( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_libentry_fields_in_lib_base.h"
@ -17,179 +17,86 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerFieldsSetup;
bSizerFieldsSetup = new wxBoxSizer( wxHORIZONTAL );
bSizerFieldsSetup = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerFiledsList;
bSizerFiledsList = new wxBoxSizer( wxVERTICAL );
m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
bSizerFiledsList->Add( fieldListCtrl, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 6 );
// Grid
m_grid->CreateGrid( 4, 11 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
// Columns
m_grid->SetColSize( 0, 72 );
m_grid->SetColSize( 1, 120 );
m_grid->SetColSize( 2, 48 );
m_grid->SetColSize( 3, 72 );
m_grid->SetColSize( 4, 72 );
m_grid->SetColSize( 5, 48 );
m_grid->SetColSize( 6, 48 );
m_grid->SetColSize( 7, 84 );
m_grid->SetColSize( 8, 84 );
m_grid->SetColSize( 9, 84 );
m_grid->SetColSize( 10, 84 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Name") );
m_grid->SetColLabelValue( 1, _("Value") );
m_grid->SetColLabelValue( 2, _("Show") );
m_grid->SetColLabelValue( 3, _("H Align") );
m_grid->SetColLabelValue( 4, _("V Align") );
m_grid->SetColLabelValue( 5, _("Italic") );
m_grid->SetColLabelValue( 6, _("Bold") );
m_grid->SetColLabelValue( 7, _("Text Size") );
m_grid->SetColLabelValue( 8, _("Orientation") );
m_grid->SetColLabelValue( 9, _("X Position") );
m_grid->SetColLabelValue( 10, _("Y Position") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
moveUpButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
moveUpButton->SetToolTip( _("Move the selected optional field up one position") );
// Rows
m_grid->EnableDragRowSize( true );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bSizer8->Add( moveUpButton, 0, wxALL, 5 );
// Label Appearance
moveDownButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
moveDownButton->SetToolTip( _("Move the selected optional field down one position") );
// Cell Defaults
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetMinSize( wxSize( -1,180 ) );
bSizer8->Add( moveDownButton, 0, wxALL, 5 );
bSizerFieldsSetup->Add( m_grid, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bButtonSize;
bButtonSize = new wxBoxSizer( wxHORIZONTAL );
m_bpAdd = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpAdd->SetMinSize( wxSize( 29,29 ) );
bButtonSize->Add( m_bpAdd, 0, 0, 5 );
m_bpDelete = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpDelete->SetMinSize( wxSize( 29,29 ) );
bButtonSize->Add( m_bpDelete, 0, wxRIGHT, 10 );
m_bpMoveUp = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpMoveUp->SetMinSize( wxSize( 29,29 ) );
bButtonSize->Add( m_bpMoveUp, 0, wxLEFT, 10 );
m_bpMoveDown = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpMoveDown->SetMinSize( wxSize( 29,29 ) );
bButtonSize->Add( m_bpMoveDown, 0, wxRIGHT, 5 );
bSizer8->Add( 0, 0, 1, wxEXPAND, 5 );
deleteFieldButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
deleteFieldButton->SetToolTip( _("Delete one of the optional fields") );
bSizer8->Add( deleteFieldButton, 0, wxALL, 5 );
addFieldButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
addFieldButton->SetToolTip( _("Add a new custom field") );
bSizer8->Add( addFieldButton, 0, wxALL, 5 );
bButtonSize->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerFiledsList->Add( bSizer8, 0, wxEXPAND, 5 );
m_spiceFieldsButton = new wxButton( this, wxID_ANY, _("Edit Spice model"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerFiledsList->Add( m_spiceFieldsButton, 0, wxALL|wxEXPAND, 5 );
bSizerFieldsSetup->Add( bSizerFiledsList, 3, wxEXPAND, 5 );
wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerJustify;
bSizerJustify = new wxBoxSizer( wxHORIZONTAL );
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horizontal Align:"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the symbol is to be rotated when drawn") );
bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxEXPAND|wxALL, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vertical Align:"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 0 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the symbol") );
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizerAspect;
bSizerAspect = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility:") ), wxVERTICAL );
showCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );
bSizerAspect->Add( visibilitySizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 0 );
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 1, wxALL|wxEXPAND|wxTOP, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name:"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 );
fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxBOTTOM|wxEXPAND, 5 );
fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value:"), wxDefaultPosition, wxDefaultSize, 0 );
fieldValueLabel->Wrap( -1 );
fieldNameBoxSizer->Add( fieldValueLabel, 0, wxTOP, 5 );
fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") );
fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxBOTTOM|wxEXPAND, 5 );
m_show_datasheet_button = new wxButton( this, wxID_ANY, _("Show in Browser"), wxDefaultPosition, wxDefaultSize, 0 );
m_show_datasheet_button->SetToolTip( _("If your datasheet is given as an http:// link, then pressing this button should bring it up in your webbrowser.") );
fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 5, 5 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
textSizeLabel->Wrap( -1 );
fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXLabel = new wxStaticText( this, wxID_ANY, _("X Position:"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("Y Position:"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the symbol anchor position") );
fgSizerPosSize->Add( posYTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALIGN_CENTER_VERTICAL, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxALL|wxEXPAND, 5 );
bSizerFieldsSetup->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
bSizerFieldsSetup->Add( bButtonSize, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 );
@ -197,6 +104,15 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
bSizerButtons->Add( 0, 0, 1, wxEXPAND, 5 );
m_spiceFieldsButton = new wxButton( this, wxID_ANY, _(" Edit Spice Model... "), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_spiceFieldsButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 25 );
stdDialogButtonSizer = new wxStdDialogButtonSizer();
stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK );
@ -204,7 +120,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 6 );
bSizerButtons->Add( stdDialogButtonSizer, 0, wxEXPAND, 6 );
mainSizer->Add( bSizerButtons, 0, wxEXPAND, 5 );
this->SetSizer( mainSizer );
@ -214,15 +133,13 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
fieldListCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeFieldsList ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::EditSpiceModel ), NULL, this );
m_show_datasheet_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::showButtonHandler ), NULL, this );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnUpdateUI ) );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnDeleteField ), NULL, this );
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveDown ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnEditSpiceModel ), NULL, this );
stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );
}
@ -232,15 +149,13 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BAS
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeFieldsList ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this );
moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this );
addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::EditSpiceModel ), NULL, this );
m_show_datasheet_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::showButtonHandler ), NULL, this );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnUpdateUI ) );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnDeleteField ), NULL, this );
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveDown ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnEditSpiceModel ), NULL, this );
stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this );
stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__
@ -11,26 +11,19 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/listctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/dialog.h>
@ -45,32 +38,13 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
private:
protected:
wxListCtrl* fieldListCtrl;
wxBitmapButton* moveUpButton;
wxBitmapButton* moveDownButton;
wxBitmapButton* deleteFieldButton;
wxBitmapButton* addFieldButton;
wxButton* m_spiceFieldsButton;
wxRadioBox* m_FieldHJustifyCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxButton* m_show_datasheet_button;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* m_staticTextUnitSize;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* m_staticTextUnitPosX;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStaticText* m_staticTextUnitPosY;
wxGrid* m_grid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxBitmapButton* m_bpMoveUp;
wxBitmapButton* m_bpMoveDown;
wxStaticLine* m_staticline1;
wxButton* m_spiceFieldsButton;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
@ -78,22 +52,20 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnSizeFieldsList( wxSizeEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void EditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void showButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Symbol Fields"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};

View File

@ -0,0 +1,444 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiway.h>
#include <kiway_player.h>
#include <dialog_shim.h>
#include <fields_grid_table.h>
#include <validators.h>
#include <class_library.h>
#include <template_fieldnames.h>
#include <widgets/grid_icon_text_helpers.h>
#include "eda_doc.h"
enum
{
MYID_SELECT_FOOTPRINT = 991, // must be within GRID_TRICKS' enum range
MYID_SHOW_DATASHEET
};
template <class T>
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( bool aInLibEdit, EDA_UNITS_T aUserUnits, LIB_PART* aPart ) :
m_userUnits( aUserUnits ),
m_part( aPart ),
m_inLibEdit( aInLibEdit ),
m_valueValidator( aInLibEdit, REFERENCE )
{
// Build the column attributes.
m_readOnlyAttr = new wxGridCellAttr;
m_readOnlyAttr->SetReadOnly( true );
m_valueColAttr = new wxGridCellAttr;
m_valueTextEditor = new wxGridCellTextEditor();
m_valueTextEditor->SetValidator( m_valueValidator );
m_valueColAttr->SetEditor( m_valueTextEditor );
m_boolColAttr = new wxGridCellAttr;
m_boolColAttr->SetRenderer( new wxGridCellBoolRenderer() );
m_boolColAttr->SetEditor( new wxGridCellBoolEditor() );
m_boolColAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
wxArrayString vAlignNames;
vAlignNames.Add( _( "Top" ) );
vAlignNames.Add( _( "Center" ) );
vAlignNames.Add( _( "Bottom" ) );
m_vAlignColAttr = new wxGridCellAttr;
m_vAlignColAttr->SetEditor( new wxGridCellChoiceEditor( vAlignNames ) );
m_vAlignColAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
wxArrayString hAlignNames;
hAlignNames.Add( _( "Left" ) );
hAlignNames.Add(_( "Center" ) );
hAlignNames.Add(_( "Right" ) );
m_hAlignColAttr = new wxGridCellAttr;
m_hAlignColAttr->SetEditor( new wxGridCellChoiceEditor( hAlignNames ) );
m_hAlignColAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
wxArrayString orientationNames;
orientationNames.Add( _( "Horizontal" ) );
orientationNames.Add(_( "Vertical" ) );
m_orientationColAttr = new wxGridCellAttr;
m_orientationColAttr->SetEditor( new wxGridCellChoiceEditor( orientationNames ) );
m_orientationColAttr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
}
template <class T>
FIELDS_GRID_TABLE<T>::~FIELDS_GRID_TABLE()
{
m_readOnlyAttr->DecRef();
m_boolColAttr->DecRef();
m_valueColAttr->DecRef();
m_vAlignColAttr->DecRef();
m_hAlignColAttr->DecRef();
m_orientationColAttr->DecRef();
}
template <class T>
wxString FIELDS_GRID_TABLE<T>::GetColLabelValue( int aCol )
{
switch( aCol )
{
case FDC_NAME: return _( "Name" );
case FDC_VALUE: return _( "Value" );
case FDC_SHOWN: return _( "Show" );
case FDC_H_ALIGN: return _( "H Align" );
case FDC_V_ALIGN: return _( "V Align" );
case FDC_ITALIC: return _( "Italic" );
case FDC_BOLD: return _( "Bold" );
case FDC_TEXT_SIZE: return _( "Text Size" );
case FDC_ORIENTATION: return _( "Orientation" );
case FDC_POSX: return _( "X Position" );
case FDC_POSY: return _( "Y Position" );
default: wxFAIL; return wxEmptyString;
}
}
template <class T>
bool FIELDS_GRID_TABLE<T>::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
{
switch( aCol )
{
case FDC_NAME:
case FDC_VALUE:
case FDC_H_ALIGN:
case FDC_V_ALIGN:
case FDC_TEXT_SIZE:
case FDC_ORIENTATION:
case FDC_POSX:
case FDC_POSY:
return aTypeName == wxGRID_VALUE_STRING;
case FDC_SHOWN:
case FDC_ITALIC:
case FDC_BOLD:
return aTypeName == wxGRID_VALUE_BOOL;
default:
wxFAIL;
return false;
}
}
template <class T>
bool FIELDS_GRID_TABLE<T>::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 )
{
switch( aCol )
{
case FDC_NAME:
if( aRow < MANDATORY_FIELDS )
{
m_readOnlyAttr->IncRef();
return m_readOnlyAttr;
}
else
return nullptr;
case FDC_VALUE:
// This field is the lib name and the default value when loading this component in
// schematic. The value is now not editable here (in this dialog) because changing
// it is equivalent to create a new component or alias. This is handled in libedit,
// not in this dialog.
if( m_inLibEdit && aRow == VALUE )
{
m_readOnlyAttr->IncRef();
return m_readOnlyAttr;
}
// For power symbols, the value is not editable, because value and pin
// name must be same and can be edited only in library editor
else if( m_part && m_part->IsPower() )
{
m_readOnlyAttr->IncRef();
return m_readOnlyAttr;
}
else
{
// Some fields have different validation semantics. Make sure the
// validator knows what it's validating.
m_valueValidator.SetFieldId( aRow );
m_valueColAttr->IncRef();
return m_valueColAttr;
}
case FDC_TEXT_SIZE:
case FDC_POSX:
case FDC_POSY:
return nullptr;
case FDC_H_ALIGN:
m_hAlignColAttr->IncRef();
return m_hAlignColAttr;
case FDC_V_ALIGN:
m_vAlignColAttr->IncRef();
return m_vAlignColAttr;
case FDC_ORIENTATION:
m_orientationColAttr->IncRef();
return m_orientationColAttr;
case FDC_SHOWN:
case FDC_ITALIC:
case FDC_BOLD:
m_boolColAttr->IncRef();
return m_boolColAttr;
default:
wxFAIL;
return nullptr;
}
}
template <class T>
wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
{
const T& field = this->at( (size_t) aRow );
switch( aCol )
{
case FDC_NAME:
// Use default field name for mandatory fields, because they are transalted
// according to the current locale
if( aRow < MANDATORY_FIELDS )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aRow );
else
return field.GetName( false );
case FDC_VALUE:
return field.GetText();
case FDC_H_ALIGN:
switch( field.GetHorizJustify() )
{
case GR_TEXT_HJUSTIFY_LEFT: return _( "Left" );
case GR_TEXT_HJUSTIFY_CENTER: return _( "Center" );
case GR_TEXT_HJUSTIFY_RIGHT: return _( "Right" );
}
case FDC_V_ALIGN:
switch( field.GetVertJustify() )
{
case GR_TEXT_VJUSTIFY_TOP: return _( "Top" );
case GR_TEXT_VJUSTIFY_CENTER: return _( "Center" );
case GR_TEXT_VJUSTIFY_BOTTOM: return _( "Bottom" );
}
case FDC_TEXT_SIZE:
return StringFromValue( m_userUnits, field.GetTextSize().GetHeight(), true, true );
case FDC_ORIENTATION:
switch( (int) field.GetTextAngle() )
{
case TEXT_ANGLE_HORIZ: return _( "Horizontal" );
case TEXT_ANGLE_VERT: return _( "Vertical" );
}
case FDC_POSX:
return StringFromValue( m_userUnits, field.GetTextPos().x, true );
case FDC_POSY:
return StringFromValue( m_userUnits, field.GetTextPos().y, true );
default:
// we can't assert here because wxWidgets sometimes calls this without checking
// the column type when trying to see if there's an overflow
return wxT( "bad wxWidgets!" );
}
}
template <class T>
bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
{
const T& field = this->at( (size_t) aRow );
switch( aCol )
{
case FDC_SHOWN: return field.IsVisible();
case FDC_ITALIC: return field.IsItalic();
case FDC_BOLD: return field.IsBold();
default:
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
return false;
}
}
template <class T>
void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue )
{
T& field = this->at( (size_t) aRow );
wxPoint pos;
switch( aCol )
{
case FDC_NAME:
field.SetName( aValue );
break;
case FDC_VALUE:
field.SetText( aValue );
break;
case FDC_H_ALIGN:
if( aValue == _( "Left" ) )
field.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
else if( aValue == _( "Center" ) )
field.SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
else if( aValue == _( "Right" ) )
field.SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
else
wxFAIL_MSG( wxT( "unknown horizontal alignment: " ) + aValue );
break;
case FDC_V_ALIGN:
if( aValue == _( "Top" ) )
field.SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
else if( aValue == _( "Center" ) )
field.SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
else if( aValue == _( "Bottom" ) )
field.SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
else
wxFAIL_MSG( wxT( "unknown vertical alignment: " ) + aValue);
break;
case FDC_TEXT_SIZE:
field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue ),
ValueFromString( m_userUnits, aValue ) ) );
break;
case FDC_ORIENTATION:
if( aValue == _( "Horizontal" ) )
field.SetTextAngle( TEXT_ANGLE_HORIZ );
else if( aValue == _( "Vertical" ) )
field.SetTextAngle( TEXT_ANGLE_VERT );
else
wxFAIL_MSG( wxT( "unknown orientation: " ) + aValue );
case FDC_POSX:
case FDC_POSY:
pos = field.GetTextPos();
if( aCol == FDC_POSX )
pos.x = ValueFromString( m_userUnits, aValue );
else
pos.y = ValueFromString( m_userUnits, aValue );
field.SetTextPos( pos );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
break;
}
GetView()->Refresh();
}
template <class T>
void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue )
{
T& field = this->at( (size_t) aRow );
switch( aCol )
{
case FDC_SHOWN:
field.SetVisible( aValue );
break;
case FDC_ITALIC:
field.SetItalic( aValue );
break;
case FDC_BOLD:
field.SetBold( aValue );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
break;
}
}
// Explicit Instantiations
template class FIELDS_GRID_TABLE<SCH_FIELD>;
template class FIELDS_GRID_TABLE<LIB_FIELD>;
void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu )
{
if( m_grid->GetGridCursorRow() == FOOTPRINT && m_grid->GetGridCursorCol() == FDC_VALUE )
{
menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ), _( "Browse for footprint" ) );
menu.AppendSeparator();
}
else if( m_grid->GetGridCursorRow() == DATASHEET && m_grid->GetGridCursorCol() == FDC_VALUE )
{
menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ), _( "Show datasheet in browser" ) );
menu.AppendSeparator();
}
GRID_TRICKS::showPopupMenu( menu );
}
void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
{
if( event.GetId() == MYID_SELECT_FOOTPRINT )
{
// pick a footprint using the footprint picker.
wxString fpid;
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true, m_dlg );
if( frame->ShowModal( &fpid, m_dlg ) )
m_grid->SetCellValue( FOOTPRINT, FDC_VALUE, fpid );
frame->Destroy();
}
else if (event.GetId() == MYID_SHOW_DATASHEET )
{
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET, FDC_VALUE );
datasheet_uri = ResolveUriByEnvVars( datasheet_uri );
GetAssociatedDocument( m_dlg, datasheet_uri );
}
else
{
GRID_TRICKS::doPopupSelection( event );
}
}

View File

@ -0,0 +1,111 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef FIELDS_GRID_TABLE_H
#define FIELDS_GRID_TABLE_H
#include <base_units.h>
#include <sch_validators.h>
#include <wx/grid.h>
#include <sch_component.h>
#include <grid_tricks.h>
class FIELDS_GRID_TRICKS : public GRID_TRICKS
{
public:
FIELDS_GRID_TRICKS( wxGrid* aGrid, DIALOG_SHIM* aDialog ) :
GRID_TRICKS( aGrid ),
m_dlg( aDialog )
{}
protected:
virtual void showPopupMenu( wxMenu& menu ) override;
virtual void doPopupSelection( wxCommandEvent& event ) override;
DIALOG_SHIM* m_dlg;
};
enum FIELDS_DATA_COL_ORDER
{
FDC_NAME,
FDC_VALUE,
FDC_SHOWN,
FDC_H_ALIGN,
FDC_V_ALIGN,
FDC_ITALIC,
FDC_BOLD,
FDC_TEXT_SIZE,
FDC_ORIENTATION,
FDC_POSX,
FDC_POSY,
FDC_COUNT // keep as last
};
template <class T>
class FIELDS_GRID_TABLE : public wxGridTableBase, public std::vector<T>
{
public:
FIELDS_GRID_TABLE( bool aInLibEdit, EDA_UNITS_T userUnits, LIB_PART* aPart );
~FIELDS_GRID_TABLE();
int GetNumberRows() override { return (int) this->size(); }
int GetNumberCols() override { return FDC_COUNT; }
wxString GetColLabelValue( int aCol ) override;
bool IsEmptyCell( int row, int col ) override
{
return false; // don't allow adjacent cell overflow, even if we are actually empty
}
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
wxGridCellAttr* GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ) override;
wxString GetValue( int aRow, int aCol ) override;
bool GetValueAsBool( int aRow, int aCol ) override;
void SetValue( int aRow, int aCol, const wxString &aValue ) override;
void SetValueAsBool( int aRow, int aCol, bool aValue ) override;
private:
EDA_UNITS_T m_userUnits;
LIB_PART* m_part;
bool m_inLibEdit;
wxGridCellTextEditor* m_valueTextEditor;
SCH_FIELD_VALIDATOR m_valueValidator;
wxGridCellAttr* m_readOnlyAttr;
wxGridCellAttr* m_valueColAttr;
wxGridCellAttr* m_boolColAttr;
wxGridCellAttr* m_vAlignColAttr;
wxGridCellAttr* m_hAlignColAttr;
wxGridCellAttr* m_orientationColAttr;
};
#endif // FIELDS_GRID_TABLE_H

View File

@ -68,8 +68,6 @@ extern std::string toUTFTildaText( const wxString& txt );
*/
class SCH_COMPONENT : public SCH_ITEM
{
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
public:
enum AUTOPLACED { AUTOPLACED_NO = 0, AUTOPLACED_AUTO, AUTOPLACED_MANUAL };
private:

View File

@ -66,6 +66,8 @@ public:
* @return true if the text in the control is valid otherwise false.
*/
virtual bool Validate( wxWindow *aParent ) override;
void SetFieldId( int aFieldId ) { m_fieldId = aFieldId; }
};