KiCad PCB EDA Suite
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC Class Reference

Dialog used to edit SCH_COMPONENT objects in a schematic. More...

Inheritance diagram for DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_EDIT_COMPONENT_IN_SCHEMATIC (SCH_EDIT_FRAME *aParent)
 
void InitBuffers (SCH_COMPONENT *aComponent)
 Initialize controls with aComponent. More...
 
SCH_EDIT_FRAMEGetParent ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

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
 
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
 
bool m_fixupsRun
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void setSelectedFieldNdx (int aFieldNdx)
 
int getSelectedFieldNdx ()
 
void copySelectedFieldToPanel ()
 Sets the values displayed on the panel according to the currently selected field row. More...
 
bool copyPanelToSelectedField ()
 Copy the values displayed on the panel fields to the currently selected field. More...
 
void copyOptionsToPanel ()
 
void copyPanelToOptions ()
 
void setRowItem (int aFieldNdx, const wxString &aName, const wxString &aValue)
 
void setRowItem (int aFieldNdx, const SCH_FIELD &aField)
 
void OnCloseDialog (wxCloseEvent &event) override
 
void OnListItemDeselected (wxListEvent &event) override
 
void OnListItemSelected (wxListEvent &event) override
 
void OnCancelButtonClick (wxCommandEvent &event) override
 
void OnOKButtonClick (wxCommandEvent &event) override
 
void SetInitCmp (wxCommandEvent &event) override
 
void UpdateFields (wxCommandEvent &event) override
 
void addFieldButtonHandler (wxCommandEvent &event) override
 
void deleteFieldButtonHandler (wxCommandEvent &event) override
 
void moveUpButtonHandler (wxCommandEvent &event) override
 
void moveDownButtonHandler (wxCommandEvent &event) override
 
void showButtonHandler (wxCommandEvent &event) override
 
void OnTestChipName (wxCommandEvent &event) override
 
void OnSelectChipName (wxCommandEvent &event) override
 
void OnSizeFieldsList (wxSizeEvent &event) override
 
void OnInitDlg (wxInitDialogEvent &event) override
 
void EditSpiceModel (wxCommandEvent &event) override
 
SCH_FIELDfindField (const wxString &aFieldName)
 
void updateDisplay ()
 Update the listbox showing fields according to the field's text. More...
 

Private Attributes

SCH_COMPONENTm_cmp
 
LIB_PARTm_part
 
bool m_skipCopyFromPanel
 
SCH_FIELDS m_FieldsBuf
 a copy of the edited symbol's SCH_FIELDs More...
 

Static Private Attributes

static int s_SelectedRow
 

Friends

class SCH_EDIT_FRAME
 

Detailed Description

Dialog used to edit SCH_COMPONENT objects in a schematic.

This is derived from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE which is maintained by wxFormBuilder. Do not auto-generate this class or file, it is hand coded.

Definition at line 66 of file dialog_edit_component_in_schematic.cpp.

Constructor & Destructor Documentation

DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC ( SCH_EDIT_FRAME aParent)

Definition at line 208 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::addFieldButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::deleteFieldButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl, g_UserUnit, GetAbbreviatedUnitsLabel(), KiBitmap(), m_cmp, m_part, m_skipCopyFromPanel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitPosX, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitPosY, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitSize, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveDownButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveUpButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::spiceFieldsButton, and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::stdDialogButtonSizerOK.

Referenced by SCH_EDIT_FRAME::EditComponent().

208  :
210 {
211 #ifndef KICAD_SPICE
212  spiceFieldsButton->Hide();
213 #endif /* not KICAD_SPICE */
214 
215  m_cmp = NULL;
216  m_part = NULL;
217  m_skipCopyFromPanel = false;
218 
219  wxListItem columnLabel;
220 
221  columnLabel.SetImage( -1 );
222 
223  columnLabel.SetText( _( "Name" ) );
224  fieldListCtrl->InsertColumn( 0, columnLabel );
225 
226  columnLabel.SetText( _( "Value" ) );
227  fieldListCtrl->InsertColumn( 1, columnLabel );
228 
232 
233  wxToolTip::Enable( true );
234  stdDialogButtonSizerOK->SetDefault();
235 
236  // Configure button logos
237  addFieldButton->SetBitmap( KiBitmap( plus_xpm ) );
238  deleteFieldButton->SetBitmap( KiBitmap( minus_xpm ) );
239  moveUpButton->SetBitmap( KiBitmap( go_up_xpm ) );
240  moveDownButton->SetBitmap( KiBitmap( go_down_xpm ) );
241 
242  Fit();
243 }
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Symbol 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)
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:485
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57

Member Function Documentation

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 567 of file dialog_edit_component_in_schematic.cpp.

References copyPanelToSelectedField(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), m_cmp, m_FieldsBuf, m_skipCopyFromPanel, REFERENCE, setRowItem(), setSelectedFieldNdx(), and EDA_TEXT::SetTextAngle().

Referenced by setRowItem().

568 {
569  // in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab
570  // screen contents.
571  if( !copyPanelToSelectedField() )
572  return;
573 
574  unsigned fieldNdx = m_FieldsBuf.size();
575 
576  SCH_FIELD blank( wxPoint(), fieldNdx, m_cmp );
577 
578  blank.SetTextAngle( m_FieldsBuf[REFERENCE].GetTextAngle() );
579 
580  m_FieldsBuf.push_back( blank );
581  m_FieldsBuf[fieldNdx].SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ) );
582 
583  m_skipCopyFromPanel = true;
584  setRowItem( fieldNdx, m_FieldsBuf[fieldNdx] );
585 
586  setSelectedFieldNdx( fieldNdx );
587  m_skipCopyFromPanel = false;
588 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
bool copyPanelToSelectedField()
Copy the values displayed on the panel fields to the currently selected field.
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol's SCH_FIELDs
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Field Reference of part, i.e. "IC21".
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel ( )
private

Definition at line 1113 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::chipnameTextCtrl, CMP_MIRROR_X, CMP_MIRROR_Y, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::convertCheckBox, DBG, LIB_ID::Format(), Format(), SCH_COMPONENT::GetConvert(), SCH_COMPONENT::GetLibId(), SCH_COMPONENT::GetOrientation(), EDA_ITEM::GetTimeStamp(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), LIB_PART::GetUnitCount(), LIB_PART::HasConversion(), m_cmp, m_part, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_textCtrlTimeStamp, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::mirrorRadioBox, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::orientationRadioBox, LIB_PART::SubReference(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitChoice, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitsInterchageableLabel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitsInterchageableText, and LIB_PART::UnitsLocked().

Referenced by InitBuffers().

1114 {
1115  // Remove non existing choices (choiceCount must be <= number for parts)
1116  int unitcount = m_part ? m_part->GetUnitCount() : 1;
1117 
1118  if( unitcount < 1 )
1119  unitcount = 1;
1120 
1121  unitChoice->Clear();
1122 
1123  for( int ii = 1; ii <= unitcount; ii++ )
1124  {
1125  unitChoice->Append( LIB_PART::SubReference( ii, false ) );
1126  }
1127 
1128  // For symbols with multiple parts per package, set the unit selection
1129  if( m_cmp->GetUnit() <= (int)unitChoice->GetCount() )
1130  unitChoice->SetSelection( m_cmp->GetUnit() - 1 );
1131 
1132  // Disable unit selection if only one unit exists:
1133  if( m_cmp->GetUnitCount() <= 1 )
1134  {
1135  unitChoice->Enable( false );
1136  unitsInterchageableLabel->Show( false );
1137  unitsInterchageableText->Show( false );
1138  }
1139  else
1140  {
1141  // Show the "Units are not interchangeable" message option?
1142  if( !m_part || !m_part->UnitsLocked() )
1143  unitsInterchageableLabel->SetLabel( _( "Yes" ) );
1144  else
1145  unitsInterchageableLabel->SetLabel( _( "No" ) );
1146  }
1147 
1148  int orientation = m_cmp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
1149 
1150  if( orientation == CMP_ORIENT_90 )
1151  orientationRadioBox->SetSelection( 1 );
1152  else if( orientation == CMP_ORIENT_180 )
1153  orientationRadioBox->SetSelection( 2 );
1154  else if( orientation == CMP_ORIENT_270 )
1155  orientationRadioBox->SetSelection( 3 );
1156  else
1157  orientationRadioBox->SetSelection( 0 );
1158 
1159  int mirror = m_cmp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );
1160 
1161  if( mirror == CMP_MIRROR_X )
1162  {
1163  mirrorRadioBox->SetSelection( 1 );
1164  DBG( printf( "mirror=X,1\n" ); )
1165  }
1166  else if( mirror == CMP_MIRROR_Y )
1167  {
1168  mirrorRadioBox->SetSelection( 2 );
1169  DBG( printf( "mirror=Y,2\n" ); )
1170  }
1171  else
1172  mirrorRadioBox->SetSelection( 0 );
1173 
1174  // Activate/Desactivate the normal/convert option ? (activated only if
1175  // the component has more than one shape)
1176  if( m_cmp->GetConvert() > 1 )
1177  convertCheckBox->SetValue( true );
1178 
1179  if( m_part == NULL || !m_part->HasConversion() )
1180  convertCheckBox->Enable( false );
1181 
1182  // Set the component's library name.
1183  chipnameTextCtrl->SetValue( m_cmp->GetLibId().Format() );
1184 
1185  // Set the component's unique ID time stamp.
1186  m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ),
1187  (unsigned long) m_cmp->GetTimeStamp() ) );
1188 }
bool UnitsLocked() const
Check whether part units are interchangeable.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
int GetOrientation()
Get the display symbol orientation.
int GetUnitCount() const
Return the number of units per package of the symbol.
int GetConvert() const
int GetUnit() const
int GetUnitCount() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static wxString SubReference(int aUnit, bool aAddSeparator=true)
const LIB_ID & GetLibId() const
UTF8 Format() const
Definition: lib_id.cpp:263
#define DBG(x)
Definition: fctsys.h:33
timestamp_t GetTimeStamp() const
Definition: base_struct.h:215
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions ( )
private

Definition at line 358 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::chipnameTextCtrl, EDA_ITEM::ClearFlags(), CMP_MIRROR_X, CMP_MIRROR_Y, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::convertCheckBox, DisplayError(), SCH_EDIT_FRAME::GetCurrentSheet(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), GetParent(), SCH_COMPONENT::GetUnitCount(), m_cmp, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::mirrorRadioBox, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::orientationRadioBox, KIWAY_HOLDER::Prj(), SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), SCH_COMPONENT::SetLibId(), SCH_COMPONENT::SetOrientation(), SCH_COMPONENT::SetUnit(), SCH_COMPONENT::SetUnitSelection(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitChoice.

Referenced by OnOKButtonClick().

359 {
360  LIB_ID id;
361  wxString msg;
362  wxString tmp = chipnameTextCtrl->GetValue();
363 
364  tmp.Replace( wxT( " " ), wxT( "_" ) );
365 
366  id.Parse( tmp );
367 
368  // Save current flags which could be modified by next change settings
369  STATUS_FLAGS flags = m_cmp->GetFlags();
370 
371  if( !id.IsValid() )
372  {
373  msg.Printf( _( "Symbol library identifier \"%s\" is not valid!" ), tmp );
374  DisplayError( this, msg );
375  }
376  else if( id != m_cmp->GetLibId() )
377  {
378  LIB_ALIAS* alias = NULL;
379 
380  try
381  {
382  alias = Prj().SchSymbolLibTable()->LoadSymbol( id );
383  }
384  catch( ... )
385  {
386  }
387 
388  if( !alias )
389  {
390  msg.Printf( _( "Symbol \"%s\" not found in library \"%s\"!" ),
391  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
392  DisplayError( this, msg );
393  }
394  else // Change symbol from lib!
395  {
396  m_cmp->SetLibId( id, Prj().SchSymbolLibTable(), Prj().SchLibs()->GetCacheLibrary() );
397  }
398  }
399 
400  // For symbols with multiple shapes (De Morgan representation) Set the selected shape:
401  if( convertCheckBox->IsEnabled() )
402  {
403  m_cmp->SetConvert( convertCheckBox->GetValue() ? 2 : 1 );
404  }
405 
406  //Set the part selection in multiple part per package
407  if( m_cmp->GetUnitCount() > 1 )
408  {
409  int unit_selection = unitChoice->GetCurrentSelection() + 1;
410 
411  m_cmp->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
412  m_cmp->SetUnit( unit_selection );
413  }
414 
415  switch( orientationRadioBox->GetSelection() )
416  {
417  case 0:
419  break;
420 
421  case 1:
423  break;
424 
425  case 2:
427  break;
428 
429  case 3:
431  break;
432  }
433 
434  int mirror = mirrorRadioBox->GetSelection();
435 
436  switch( mirror )
437  {
438  case 0:
439  break;
440 
441  case 1:
443  break;
444 
445  case 2:
447  break;
448  }
449 
450  // Restore m_Flag modified by SetUnit() and other change settings
451  m_cmp->ClearFlags();
452  m_cmp->SetFlags( flags );
453 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
Part library alias object definition.
void SetUnitSelection(SCH_SHEET_PATH *aSheet, int aUnitSelection)
int GetUnitCount() const
Return the number of units per package of the symbol.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SetConvert(int aConvert)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetLibId(const LIB_ID &aName, PART_LIBS *aLibs=NULL)
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
unsigned STATUS_FLAGS
Definition: base_struct.h:142
void SetUnit(int aUnit)
Change the unit number to aUnit.
const LIB_ID & GetLibId() const
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField ( )
private

Copy the values displayed on the panel fields to the currently selected field.

Returns
bool - true if all fields are OK, else false if the user has put bad data into a field, and this value can be used to deny a row change.

Definition at line 1046 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldNameTextCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldValueTextCtrl, g_UserUnit, getSelectedFieldNdx(), EDA_TEXT::GetTextAngle(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldHJustifyCtrl, m_FieldsBuf, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldVJustifyCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_StyleRadioBox, EDA_GRAPHIC_TEXT_CTRL::ParseSize(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posXTextCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posYTextCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::rotateCheckBox, EDA_TEXT::SetBold(), EDA_TEXT::SetHorizJustify(), EDA_TEXT::SetItalic(), SCH_FIELD::SetName(), setRowItem(), EDA_TEXT::SetText(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextPos(), EDA_TEXT::SetTextSize(), EDA_TEXT::SetVertJustify(), EDA_TEXT::SetVisible(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::showCheckBox, TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::textSizeTextCtrl, VALUE, ValueFromString(), wxPoint::x, and wxPoint::y.

Referenced by addFieldButtonHandler(), moveDownButtonHandler(), moveUpButtonHandler(), OnListItemDeselected(), and OnOKButtonClick().

1047 {
1048  unsigned fieldNdx = getSelectedFieldNdx();
1049 
1050  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
1051  return true;
1052 
1053  // Check for illegal field text.
1054  if( fieldValueTextCtrl->GetValidator()
1055  && !fieldValueTextCtrl->GetValidator()->Validate( this ) )
1056  return false;
1057 
1058  SCH_FIELD& field = m_FieldsBuf[fieldNdx];
1059 
1060  field.SetVisible( showCheckBox->GetValue() );
1061 
1062  if( rotateCheckBox->GetValue() )
1063  field.SetTextAngle( TEXT_ANGLE_VERT );
1064  else
1065  field.SetTextAngle( TEXT_ANGLE_HORIZ );
1066 
1067  rotateCheckBox->SetValue( field.GetTextAngle() == TEXT_ANGLE_VERT );
1068 
1069  // Copy the text justification
1070  static const EDA_TEXT_HJUSTIFY_T hjustify[] = {
1074  };
1075 
1076  static const EDA_TEXT_VJUSTIFY_T vjustify[] = {
1080  };
1081 
1082  field.SetHorizJustify( hjustify[m_FieldHJustifyCtrl->GetSelection()] );
1083  field.SetVertJustify( vjustify[m_FieldVJustifyCtrl->GetSelection()] );
1084 
1085  field.SetName( fieldNameTextCtrl->GetValue() );
1086 
1087  /* Void fields texts for REFERENCE and VALUE (value is the name of the
1088  * component in lib ! ) are not allowed
1089  * change them only for a new non void value
1090  * When void, usually netlists are broken
1091  */
1092  if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE )
1093  field.SetText( fieldValueTextCtrl->GetValue() );
1094 
1095  setRowItem( fieldNdx, field ); // update fieldListCtrl
1096 
1098  field.SetTextSize( wxSize( tmp, tmp ) );
1099  int style = m_StyleRadioBox->GetSelection();
1100 
1101  field.SetItalic( (style & 1 ) != 0 );
1102  field.SetBold( (style & 2 ) != 0 );
1103 
1104  wxPoint pos;
1105  pos.x = ValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
1106  pos.y = ValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
1107  field.SetTextPos( pos );
1108 
1109  return true;
1110 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:154
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
void SetItalic(bool isItalic)
Definition: eda_text.h:167
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:221
void SetVisible(bool aVisible)
Definition: eda_text.h:173
static int ParseSize(const wxString &sizeText, EDA_UNITS_T user_unit)
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:212
#define TEXT_ANGLE_VERT
Definition: common.h:92
double GetTextAngle() const
Definition: eda_text.h:162
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:192
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:370
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:54
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:191
void SetName(const wxString &aName)
Definition: sch_field.h:85
#define VALUE
void SetBold(bool aBold)
Definition: eda_text.h:170
virtual void SetText(const wxString &aText)
Definition: eda_text.h:139
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel ( )
private

Sets the values displayed on the panel according to the currently selected field row.

Definition at line 927 of file dialog_edit_component_in_schematic.cpp.

References DATASHEET, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::deleteFieldButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldNameTextCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldValueTextCtrl, FOOTPRINT, EDA_GRAPHIC_TEXT_CTRL::FormatSize(), g_UserUnit, EDA_TEXT::GetHorizJustify(), SCH_FIELD::GetId(), SCH_FIELD::GetName(), getSelectedFieldNdx(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextWidth(), EDA_TEXT::GetVertJustify(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_TOP, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), LIB_PART::IsPower(), EDA_TEXT::IsVisible(), m_cmp, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldHJustifyCtrl, m_FieldsBuf, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldVJustifyCtrl, m_part, SCH_COMPONENT::m_Pos, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_show_datasheet_button, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_StyleRadioBox, MANDATORY_FIELDS, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveDownButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::moveUpButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posXTextCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posYTextCtrl, REFERENCE, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::rotateCheckBox, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::showCheckBox, StringFromValue(), TEXT_ANGLE_VERT, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::textSizeTextCtrl, VALUE, wxPoint::x, and wxPoint::y.

Referenced by InitBuffers(), OnListItemSelected(), OnSelectChipName(), and UpdateFields().

928 {
929  wxCHECK_RET( m_cmp != NULL, wxT( "Component pointer not initialized." ) );
930 
931  unsigned fieldNdx = getSelectedFieldNdx();
932 
933  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
934  return;
935 
936  SCH_FIELD& field = m_FieldsBuf[fieldNdx];
937 
938  showCheckBox->SetValue( field.IsVisible() );
939 
940  rotateCheckBox->SetValue( field.GetTextAngle() == TEXT_ANGLE_VERT );
941 
942  int style = 0;
943 
944  if( field.IsItalic() )
945  style = 1;
946 
947  if( field.IsBold() )
948  style |= 2;
949 
950  m_StyleRadioBox->SetSelection( style );
951 
952  // Select the right text justification
953  if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
954  m_FieldHJustifyCtrl->SetSelection( 0 );
955  else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
956  m_FieldHJustifyCtrl->SetSelection( 2 );
957  else
958  m_FieldHJustifyCtrl->SetSelection( 1 );
959 
960  if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
961  m_FieldVJustifyCtrl->SetSelection( 0 );
962  else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
963  m_FieldVJustifyCtrl->SetSelection( 2 );
964  else
965  m_FieldVJustifyCtrl->SetSelection( 1 );
966 
967 
968  fieldNameTextCtrl->SetValue( field.GetName( false ) );
969 
970  // the names of the fixed fields are not editable, others are.
971  fieldNameTextCtrl->Enable( fieldNdx >= MANDATORY_FIELDS );
972  fieldNameTextCtrl->SetEditable( fieldNdx >= MANDATORY_FIELDS );
973 
974  // only user defined fields may be moved, and not the top most user defined
975  // field since it would be moving up into the fixed fields, > not >=
976  moveUpButton->Enable( fieldNdx > MANDATORY_FIELDS );
977  moveDownButton->Enable( ( fieldNdx >= MANDATORY_FIELDS ) && ( fieldNdx < ( m_FieldsBuf.size() - 1 ) ) );
978 
979  // may only delete user defined fields
980  deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
981 
982  fieldValueTextCtrl->SetValidator( SCH_FIELD_VALIDATOR( false, field.GetId() ) );
983  fieldValueTextCtrl->SetValue( field.GetText() );
984 
985  m_show_datasheet_button->Enable( fieldNdx == DATASHEET || fieldNdx == FOOTPRINT );
986 
987  if( fieldNdx == DATASHEET )
988  {
989  m_show_datasheet_button->SetLabel( _( "Show Datasheet" ) );
990  m_show_datasheet_button->SetToolTip(
991  _("If your datasheet is given as an http:// link,"
992  " then pressing this button should bring it up in your webbrowser.") );
993  }
994  else if( fieldNdx == FOOTPRINT )
995  {
996  m_show_datasheet_button->SetLabel( _( "Browse Footprints" ) );
997  m_show_datasheet_button->SetToolTip(
998  _("Open the footprint browser to choose a footprint and assign it.") );
999  }
1000  else
1001  {
1002  m_show_datasheet_button->SetLabel( wxEmptyString );
1003  m_show_datasheet_button->SetToolTip(
1004  _("Used only for fields Footprint and Datasheet.") );
1005  }
1006 
1007  // For power symbols, the value is NOR editable, because value and pin
1008  // name must be same and can be edited only in library editor
1009  if( fieldNdx == VALUE && m_part && m_part->IsPower() )
1010  fieldValueTextCtrl->Enable( false );
1011  else
1012  fieldValueTextCtrl->Enable( true );
1013 
1015 
1016  wxPoint coord = field.GetTextPos();
1017  wxPoint zero = -m_cmp->m_Pos; // relative zero
1018 
1019  // If the field value is empty and the position is at relative zero, we
1020  // set the initial position as a small offset from the ref field, and
1021  // orient it the same as the ref field. That is likely to put it at least
1022  // close to the desired position.
1023  if( coord == zero && field.GetText().IsEmpty() )
1024  {
1025  rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetTextAngle() == TEXT_ANGLE_VERT );
1026 
1027  coord.x = m_FieldsBuf[REFERENCE].GetTextPos().x
1028  + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
1029 
1030  coord.y = m_FieldsBuf[REFERENCE].GetTextPos().y
1031  + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
1032 
1033  // coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
1034  // That is ok, we basically don't want all the new empty fields on
1035  // top of each other.
1036  }
1037 
1038  wxString coordText = StringFromValue( g_UserUnit, coord.x );
1039  posXTextCtrl->SetValue( coordText );
1040 
1041  coordText = StringFromValue( g_UserUnit, coord.y );
1042  posYTextCtrl->SetValue( coordText );
1043 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:438
name of datasheet
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
bool IsItalic() const
Definition: eda_text.h:168
bool IsPower() const
int GetId() const
Definition: sch_field.h:87
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
int GetTextWidth() const
Definition: eda_text.h:216
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:188
#define TEXT_ANGLE_VERT
Definition: common.h:92
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
bool IsBold() const
Definition: eda_text.h:171
double GetTextAngle() const
Definition: eda_text.h:162
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:189
bool IsVisible() const
Definition: eda_text.h:174
class SCH_FILED_VALIDATOR
#define VALUE
static wxString FormatSize(EDA_UNITS_T user_unit, int textSize)
Function FormatSize formats a string containing the size in the desired units.
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 591 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl, getSelectedFieldNdx(), m_FieldsBuf, m_skipCopyFromPanel, MANDATORY_FIELDS, setSelectedFieldNdx(), and updateDisplay().

Referenced by setRowItem().

592 {
593  unsigned fieldNdx = getSelectedFieldNdx();
594 
595  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
596  return;
597 
598  if( fieldNdx < MANDATORY_FIELDS )
599  {
600  wxBell();
601  return;
602  }
603 
604  m_skipCopyFromPanel = true;
605  m_FieldsBuf.erase( m_FieldsBuf.begin() + fieldNdx );
606  fieldListCtrl->DeleteItem( fieldNdx );
607 
608  if( fieldNdx >= m_FieldsBuf.size() )
609  --fieldNdx;
610 
611  updateDisplay();
612 
613  setSelectedFieldNdx( fieldNdx );
614  m_skipCopyFromPanel = false;
615 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
void updateDisplay()
Update the listbox showing fields according to the field&#39;s text.
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::EditSpiceModel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 319 of file dialog_edit_component_in_schematic.cpp.

References m_cmp, m_FieldsBuf, setSelectedFieldNdx(), and updateDisplay().

Referenced by OnInitDlg().

320 {
321 #ifdef KICAD_SPICE
322  setSelectedFieldNdx( 0 );
323  DIALOG_SPICE_MODEL dialog( this, *m_cmp, m_FieldsBuf );
324 
325  if( dialog.ShowModal() == wxID_OK )
326  updateDisplay();
327 #endif /* KICAD_SPICE */
328 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
void updateDisplay()
Update the listbox showing fields according to the field&#39;s text.
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 205 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues(), and DIALOG_SHIM::IsQuasiModal().

206 {
207  // so we can do logging of this state change:
208 
209 #if defined(DEBUG)
210  const char* type_id = typeid( *this ).name();
211  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
212 #endif
213 
214  return wxDialog::Enable( enable );
215 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 612 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

613 {
614  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
615  // handle validation in the same way as other dialogs.
616  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
617  return;
618 
619  SetReturnCode( retCode );
620 
621  if( !IsQuasiModal() )
622  {
623  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
624  return;
625  }
626 
627  if( m_qmodal_loop )
628  {
629  if( m_qmodal_loop->IsRunning() )
630  m_qmodal_loop->Exit( 0 );
631  else
632  m_qmodal_loop->ScheduleExit( 0 );
633 
634  m_qmodal_loop = NULL;
635  }
636 
639 
640  Show( false );
641 }
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool IsQuasiModal()
Definition: dialog_shim.h:103
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
SCH_FIELD * DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::findField ( const wxString &  aFieldName)
private

Definition at line 750 of file dialog_edit_component_in_schematic.cpp.

References i, and m_FieldsBuf.

Referenced by InitBuffers(), and OnInitDlg().

751 {
752  for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
753  {
754  if( aFieldName == m_FieldsBuf[i].GetName( false ) )
755  return &m_FieldsBuf[i];
756  }
757 
758  return NULL;
759 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
size_t i
Definition: json11.cpp:597
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_SHIM::IsQuasiModal(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DIALOG_EDIT_FPTEXT::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_FOOTPRINT_FP_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), and DIALOG_UPDATE_FIELDS::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
SCH_EDIT_FRAME* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::GetParent ( )
inline

Definition at line 78 of file dialog_edit_component_in_schematic.cpp.

Referenced by copyPanelToOptions(), InitBuffers(), OnOKButtonClick(), OnSelectChipName(), SetInitCmp(), and UpdateFields().

78 { return dynamic_cast< SCH_EDIT_FRAME* >( wxDialog::GetParent() ); }
Schematic editor (Eeschema) main window.
int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::getSelectedFieldNdx ( )
private
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 125 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_SHIM::IsQuasiModal().

126 {
127  wxSize sz( x, 0 );
128  return ConvertDialogToPixels( sz ).x;
129 }
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers ( SCH_COMPONENT aComponent)

Initialize controls with aComponent.

Parameters
aComponentThe component to edit.

Definition at line 762 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::chipnameTextCtrl, copyOptionsToPanel(), copySelectedFieldToPanel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl, findField(), SCH_COMPONENT::FindField(), SCH_EDIT_FRAME::GetCurrentSheet(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), SCH_COMPONENT::GetFieldCount(), SCH_COMPONENT::GetLibId(), SCH_BASE_FRAME::GetLibPart(), SCH_FIELD::GetName(), GetParent(), SCH_COMPONENT::GetRef(), SCH_EDIT_FRAME::GetTemplateFieldNames(), i, EDA_ITEM::IsDragging(), m_cmp, SCH_COMPONENT::m_Fields, m_FieldsBuf, m_part, SCH_COMPONENT::m_Pos, MANDATORY_FIELDS, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::mirrorRadioBox, EDA_TEXT::Offset(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::orientationRadioBox, REFERENCE, s_SelectedRow, setRowItem(), setSelectedFieldNdx(), EDA_TEXT::SetVisible(), and TO_UTF8.

Referenced by SCH_EDIT_FRAME::EditComponent().

763 {
764  m_cmp = aComponent;
765 
766  /* We have 3 component related field lists to be aware of: 1) UI
767  presentation, 2) fields in component ram copy, and 3) fields recorded
768  with component on disk. m_FieldsBuf is the list of UI fields, and this
769  list is not the same as the list which is in the component, which is
770  also not the same as the list on disk. All 3 lists are potentially
771  different. In the UI we choose to preserve the order of the first
772  MANDATORY_FIELDS which are sometimes called fixed fields. Then we append
773  the template fieldnames in the exact same order as the template
774  fieldname editor shows them. Then we append any user defined fieldnames
775  which came from the component.
776  */
777 
778  m_part = GetParent()->GetLibPart( m_cmp->GetLibId(), true );
779 
780 #if 0 && defined(DEBUG)
781  for( int i = 0; i<aComponent->GetFieldCount(); ++i )
782  {
783  printf( "Orig[%d] (x=%d, y=%d)\n", i,
784  aComponent->m_Fields[i].GetTextPos().x,
785  aComponent->m_Fields[i].GetTextPos().y );
786  }
787 
788 #endif
789 
790  // When this code was written, all field constructors ensure that the fixed fields
791  // are all present within a component. So we can knowingly copy them over
792  // in the normal order. Copy only the fixed fields at first.
793  // Please do not break the field constructors.
794 
795  m_FieldsBuf.clear();
796 
797  for( int i=0; i<MANDATORY_FIELDS; ++i )
798  {
799  m_FieldsBuf.push_back( aComponent->m_Fields[i] );
800 
801  // make the editable field position relative to the component
802  m_FieldsBuf[i].Offset( -m_cmp->m_Pos );
803 
804  // Ensure the Field name reflects the default name, even if the
805  // local has changed since schematic was read
807  }
808 
809  // Add template fieldnames:
810  // Now copy in the template fields, in the order that they are present in the
811  // template field editor UI.
813 
814  for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it )
815  {
816  // add a new field unconditionally to the UI only
817  SCH_FIELD fld( wxPoint(0,0), -1 /* id is a relic */, m_cmp, it->m_Name );
818 
819  // See if field by same name already exists in component.
820  SCH_FIELD* schField = aComponent->FindField( it->m_Name );
821 
822  // If the field does not already exist in the component, then we
823  // use defaults from the template fieldname, otherwise the original
824  // values from the component will be set.
825  if( !schField )
826  {
827  fld.SetVisible( it->m_Visible );
828  }
829  else
830  {
831  fld = *schField;
832 
833  // make the editable field position relative to the component
834  fld.Offset( -m_cmp->m_Pos );
835  }
836 
837  m_FieldsBuf.push_back( fld );
838  }
839 
840  // Lastly, append any original fields from the component which were not added
841  // from the set of fixed fields nor from the set of template fields.
842  for( unsigned i=MANDATORY_FIELDS; i<aComponent->m_Fields.size(); ++i )
843  {
844  SCH_FIELD* cmp = &aComponent->m_Fields[i];
845  SCH_FIELD* buf = findField( cmp->GetName( false ) );
846 
847  if( !buf )
848  {
849  int newNdx = m_FieldsBuf.size();
850  m_FieldsBuf.push_back( *cmp );
851 
852  // make the editable field position relative to the component
853  m_FieldsBuf[newNdx].Offset( -m_cmp->m_Pos );
854  }
855  }
856 
857 
858 #if 0 && defined(DEBUG)
859  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
860  {
861  printf( "m_FieldsBuf[%d] (x=%-3d, y=%-3d) name:%s\n", i, m_FieldsBuf[i].m_Pos.x,
862  m_FieldsBuf[i].m_Pos.y, TO_UTF8(m_FieldsBuf[i].GetName( false ) ) );
863  }
864 #endif
865 
866  m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( &GetParent()->GetCurrentSheet() ) );
867 
868  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
869  {
870  setRowItem( i, m_FieldsBuf[i] );
871  }
872 
873 #if 0 && defined(DEBUG)
874  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
875  {
876  printf( "after[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
877  m_FieldsBuf[i].m_Pos.y );
878  }
879 
880 #endif
881 
883 
884  // disable some options inside the edit dialog
885  // which can cause problems while dragging
886  if( m_cmp->IsDragging() )
887  {
888  orientationRadioBox->Disable();
889  mirrorRadioBox->Disable();
890  chipnameTextCtrl->Disable();
891  }
892 
893  // put focus on the list ctrl
894  fieldListCtrl->SetFocus();
895 
896  // resume editing at the last row edited, last time dialog was up.
898 
900 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:227
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:438
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
SCH_FIELD * findField(const wxString &aFieldName)
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
void SetVisible(bool aVisible)
Definition: eda_text.h:173
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Field Reference of part, i.e. "IC21".
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field names list for read only access.
int GetFieldCount() const
Return the number of fields in this symbol.
size_t i
Definition: json11.cpp:597
const LIB_ID & GetLibId() const
void copySelectedFieldToPanel()
Sets the values displayed on the panel according to the currently selected field row.
bool IsDragging() const
Definition: base_struct.h:230
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveDownButtonHandler ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 685 of file dialog_edit_component_in_schematic.cpp.

References copyPanelToSelectedField(), getSelectedFieldNdx(), m_FieldsBuf, m_skipCopyFromPanel, MANDATORY_FIELDS, setRowItem(), setSelectedFieldNdx(), and updateDisplay().

Referenced by setRowItem().

686 {
687  unsigned fieldNdx = getSelectedFieldNdx();
688 
689  // Ensure there is at least one field after this one
690  if( fieldNdx >= ( m_FieldsBuf.size() - 1 ) )
691  {
692  return;
693  }
694 
695  // The first field which can be moved up is the second user field
696  // so any field which id < MANDATORY_FIELDS cannot be moved down
697  if( fieldNdx < MANDATORY_FIELDS )
698  return;
699 
700  if( !copyPanelToSelectedField() )
701  return;
702 
703  // swap the fieldNdx field with the one before it, in both the vector
704  // and in the fieldListCtrl
705  SCH_FIELD tmp = m_FieldsBuf[fieldNdx + 1];
706 
707  m_FieldsBuf[fieldNdx + 1] = m_FieldsBuf[fieldNdx];
708  setRowItem( fieldNdx + 1, m_FieldsBuf[fieldNdx] );
709  m_FieldsBuf[fieldNdx + 1].SetId( fieldNdx + 1 );
710 
711  m_FieldsBuf[fieldNdx] = tmp;
712  setRowItem( fieldNdx, tmp );
713  m_FieldsBuf[fieldNdx].SetId( fieldNdx );
714 
715  updateDisplay( );
716 
717  m_skipCopyFromPanel = true;
718  setSelectedFieldNdx( fieldNdx + 1 );
719  m_skipCopyFromPanel = false;
720 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
bool copyPanelToSelectedField()
Copy the values displayed on the panel fields to the currently selected field.
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
void updateDisplay()
Update the listbox showing fields according to the field&#39;s text.
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 648 of file dialog_edit_component_in_schematic.cpp.

References copyPanelToSelectedField(), DBG, SCH_FIELD::GetName(), getSelectedFieldNdx(), EDA_TEXT::GetText(), m_FieldsBuf, m_skipCopyFromPanel, MANDATORY_FIELDS, setRowItem(), setSelectedFieldNdx(), TO_UTF8, and updateDisplay().

Referenced by setRowItem().

649 {
650  unsigned fieldNdx = getSelectedFieldNdx();
651 
652  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
653  return;
654 
655  if( fieldNdx <= MANDATORY_FIELDS )
656  {
657  wxBell();
658  return;
659  }
660 
661  if( !copyPanelToSelectedField() )
662  return;
663 
664  // swap the fieldNdx field with the one before it, in both the vector
665  // and in the fieldListCtrl
666  SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
667 
668  DBG( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
669  TO_UTF8( tmp.GetText() ), TO_UTF8( tmp.GetName( false ) ) ); )
670 
671  m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
672  setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
673 
674  m_FieldsBuf[fieldNdx] = tmp;
675  setRowItem( fieldNdx, tmp );
676 
677  updateDisplay();
678 
679  m_skipCopyFromPanel = true;
680  setSelectedFieldNdx( fieldNdx - 1 );
681  m_skipCopyFromPanel = false;
682 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
bool copyPanelToSelectedField()
Copy the values displayed on the panel fields to the currently selected field.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:438
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
void updateDisplay()
Update the listbox showing fields according to the field&#39;s text.
#define DBG(x)
Definition: fctsys.h:33
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 352 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_SHIM::EndQuasiModal().

Referenced by setRowItem().

353 {
354  EndQuasiModal( wxID_CANCEL );
355 }
void EndQuasiModal(int retCode)
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog ( wxCloseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 340 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_SHIM::EndQuasiModal().

Referenced by setRowItem().

341 {
342  // On wxWidgets 2.8, and on Linux, calling EndQuasiModal here is mandatory
343  // Otherwise, the main event loop is never restored, and Eeschema does not
344  // respond to any event, because the DIALOG_SHIM destructor is never called.
345  // On wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called,
346  // and calls EndQuasiModal.
347  // therefore calling EndQuasiModal here is not always mandatory but it creates no issues
348  EndQuasiModal( wxID_CANCEL );
349 }
void EndQuasiModal(int retCode)
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg ( wxInitDialogEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 146 of file dialog_edit_component_in_schematic.cpp.

References EditSpiceModel(), findField(), and DIALOG_SHIM::FinishDialogSettings().

147  {
148  TransferDataToWindow();
149 
150  // Now all widgets have the size fixed, call FinishDialogSettings
152  }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemDeselected ( wxListEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 246 of file dialog_edit_component_in_schematic.cpp.

References copyPanelToSelectedField(), and m_skipCopyFromPanel.

Referenced by setRowItem().

247 {
248  if( !m_skipCopyFromPanel )
249  {
250  if( !copyPanelToSelectedField() )
251  event.Skip(); // do not go to the next row
252  }
253 }
bool copyPanelToSelectedField()
Copy the values displayed on the panel fields to the currently selected field.
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected ( wxListEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 331 of file dialog_edit_component_in_schematic.cpp.

References copySelectedFieldToPanel(), and s_SelectedRow.

Referenced by setRowItem().

332 {
333  // remember the selected row, statically
334  s_SelectedRow = event.GetIndex();
335 
337 }
void copySelectedFieldToPanel()
Sets the values displayed on the panel according to the currently selected field row.
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 456 of file dialog_edit_component_in_schematic.cpp.

References copyPanelToOptions(), copyPanelToSelectedField(), DATASHEET, DisplayError(), DIALOG_SHIM::EndQuasiModal(), FOOTPRINT, Format(), GetChars(), SCH_REFERENCE::GetComp(), SCH_SHEET_PATH::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_COMPONENT::GetField(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), LIB_PART::GetLibId(), LIB_ID::GetLibItemName(), SCH_REFERENCE::GetLibPart(), SCH_BASE_FRAME::GetLibPart(), GetParent(), SCH_REFERENCE::GetRef(), SCH_COMPONENT::GetRef(), SCH_EDIT_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), SCH_EDIT_FRAME::GetTemplates(), GetText(), SCH_REFERENCE::GetUnit(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), TEMPLATES::HasFieldName(), i, LIB_PART::IsPower(), SCH_COMPONENT::IsReferenceStringValid(), BASE_SCREEN::m_BlockLocate, m_cmp, m_FieldsBuf, SCH_COMPONENT::m_Pos, MANDATORY_FIELDS, SCH_EDIT_FRAME::OnModify(), REFERENCE, SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT::SetFields(), SCH_COMPONENT::SetRef(), EDA_TEXT::SetText(), STATE_NO_BLOCK, SCH_SCREEN::TestDanglingEnds(), SCH_COMPONENT::UpdatePinCache(), UR_CHANGED, and VALUE.

Referenced by setRowItem().

457 {
458  bool removeRemainingFields = false;
459 
460  if( !copyPanelToSelectedField() )
461  return;
462 
464  {
465  DisplayError( NULL, _( "Illegal reference. References must start with a letter" ) );
466  return;
467  }
468 
469  // save old cmp in undo list if not already in edit, or moving ...
470  // or the component to be edited is part of a block
471  if( m_cmp->GetFlags() == 0
474 
476 
477  // Delete any fields with no name before we copy all of m_FieldsBuf back into the component.
478  for( unsigned i = MANDATORY_FIELDS; i<m_FieldsBuf.size(); )
479  {
480  if( m_FieldsBuf[i].GetName( false ).IsEmpty() || m_FieldsBuf[i].GetText().IsEmpty() )
481  {
482  // If a field has no value and is not it the field template list, warn the user
483  // that it will be remove from the component. This gives the user a chance to
484  // correct the problem before removing the undefined fields. It should also
485  // resolve most of the bug reports and questions regarding missing fields.
486  if( !m_FieldsBuf[i].GetName( false ).IsEmpty() && m_FieldsBuf[i].GetText().IsEmpty()
487  && !GetParent()->GetTemplates().HasFieldName( m_FieldsBuf[i].GetName( false ) )
488  && !removeRemainingFields )
489  {
490  wxString msg = wxString::Format(
491  _( "The field name \"%s\" does not have a value and is not defined in "
492  "the field template list. Empty field values are invalid an will "
493  "be removed from the component. Do you wish to remove this and "
494  "all remaining undefined fields?" ),
495  GetChars( m_FieldsBuf[i].GetName( false ) )
496  );
497 
498  wxMessageDialog dlg( this, msg, _( "Remove Fields" ), wxYES_NO | wxNO_DEFAULT );
499 
500  if( dlg.ShowModal() == wxID_NO )
501  return;
502 
503  removeRemainingFields = true;
504  }
505 
506  m_FieldsBuf.erase( m_FieldsBuf.begin() + i );
507  continue;
508  }
509 
510  ++i;
511  }
512 
513  // change all field positions from relative to absolute
514  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
515  {
516  m_FieldsBuf[i].Offset( m_cmp->m_Pos );
517  }
518 
519  LIB_PART* entry = GetParent()->GetLibPart( m_cmp->GetLibId() );
520 
521  if( entry && entry->IsPower() )
522  m_FieldsBuf[VALUE].SetText( m_cmp->GetLibId().GetLibItemName() );
523 
524  // copy all the fields back, and change the length of m_Fields.
526 
527  // Reference has a specific initialization, depending on the current active sheet
528  // because for a given component, in a complex hierarchy, there are more than one
529  // reference.
530  m_cmp->SetRef( &GetParent()->GetCurrentSheet(), m_FieldsBuf[REFERENCE].GetText() );
531 
532  // The value, footprint and datasheet fields should be kept in sync in multi-unit
533  // parts.
534  if( m_cmp->GetUnitCount() > 1 )
535  {
536  const LIB_ID thisLibId = m_cmp->GetLibId();
537  const wxString thisRef = m_cmp->GetRef( &( GetParent()->GetCurrentSheet() ) );
538  int thisUnit = m_cmp->GetUnit();
539 
540  SCH_REFERENCE_LIST components;
541  GetParent()->GetCurrentSheet().GetComponents( components );
542  for( unsigned i = 0; i < components.GetCount(); i++ )
543  {
544  SCH_REFERENCE component = components[i];
545  if( component.GetLibPart()->GetLibId() == thisLibId
546  && component.GetRef() == thisRef
547  && component.GetUnit() != thisUnit )
548  {
549  SCH_COMPONENT* otherUnit = component.GetComp();
550  GetParent()->SaveCopyInUndoList( otherUnit, UR_CHANGED, true /* append */);
551  otherUnit->GetField( VALUE )->SetText( m_FieldsBuf[VALUE].GetText() );
552  otherUnit->GetField( FOOTPRINT )->SetText( m_FieldsBuf[FOOTPRINT].GetText() );
553  otherUnit->GetField( DATASHEET )->SetText( m_FieldsBuf[DATASHEET].GetText() );
554  }
555  }
556  }
557 
559 
560  GetParent()->OnModify();
562 
563  EndQuasiModal( wxID_OK );
564 }
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
bool copyPanelToSelectedField()
Copy the values displayed on the panel fields to the currently selected field.
const TEMPLATES & GetTemplates()
Return the field names template for read only access.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
name of datasheet
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
bool IsPower() const
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
const LIB_ID & GetLibId() const
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
int GetUnitCount() const
Return the number of units per package of the symbol.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int GetUnit() const
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void UpdatePinCache()
Updates the local cache of pin positions.
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
SCH_SHEET_PATH & GetCurrentSheet()
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
Define a library symbol object.
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
int GetUnit() const
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
wxString GetRef() const
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void EndQuasiModal(int retCode)
bool HasFieldName(const wxString &aName) const
Function HasFieldName checks for aName in the the template field name list.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
BLOCK_STATE_T GetState() const
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:913
size_t i
Definition: json11.cpp:597
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
const LIB_ID & GetLibId() const
LIB_PART * GetLibPart() const
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
unsigned GetCount()
Function GetCount.
SCH_COMPONENT * GetComp() const
#define VALUE
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
Class SCH_REFERENCE is used as a helper to define a component&#39;s reference designator in a schematic...
virtual void SetText(const wxString &aText)
Definition: eda_text.h:139
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 271 of file dialog_shim.cpp.

References DIALOG_SHIM::m_fixupsRun, and recursiveDescent().

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and DIALOG_SHIM::IsQuasiModal().

272 {
273  if( !m_fixupsRun )
274  {
275 #if DLGSHIM_SELECT_ALL_IN_TEXT_CONTROLS
276  const bool selectAllInTextCtrls = true;
277 #else
278  const bool selectAllInTextCtrls = false;
279 #endif
280  wxWindow* firstTextCtrl = NULL;
281  wxWindow* windowWithFocus = NULL;
282 
283  recursiveDescent( GetChildren(), selectAllInTextCtrls, firstTextCtrl,
284  windowWithFocus );
285 
286 #if DLGSHIM_USE_SETFOCUS
287  // While it would be nice to honour any focus already set (which was
288  // recorded in windowWithFocus), the reality is that it's currently wrong
289  // far more often than it's right.
290  // So just focus on the first text control if we have one; otherwise the
291  // focus on the dialog itself, which will at least allow esc, return, etc.
292  // to function.
293  if( firstTextCtrl )
294  firstTextCtrl->SetFocus();
295  else
296  SetFocus();
297 #endif
298 
299 #ifdef __WXMAC__
300  fixOSXCancelButtonIssue( this );
301 #endif
302 
303  m_fixupsRun = true;
304  }
305 
306  event.Skip();
307 }
static void recursiveDescent(wxWindowList &children, const bool selectTextInTextCtrls, wxWindow *&firstTextCtrl, wxWindow *&windowWithFocus)
bool m_fixupsRun
Definition: dialog_shim.h:149
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 293 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::chipnameTextCtrl, copySelectedFieldToPanel(), dummy(), SCH_BASE_FRAME::GetLibPart(), GetParent(), LIB_PART::IsPower(), m_FieldsBuf, s_SelectedRow, SCH_BASE_FRAME::SelectComponentFromLibrary(), setRowItem(), and VALUE.

Referenced by setRowItem().

294 {
296 
297  auto sel = GetParent()->SelectComponentFromLibrary( NULL, dummy, true, 0, 0, false );
298 
299  if( !sel.LibId.IsValid() )
300  return;
301 
302  chipnameTextCtrl->SetValue( sel.LibId.Format() );
303 
304  // Update the value field for Power symbols
305  LIB_PART* entry = GetParent()->GetLibPart( sel.LibId );
306 
307  if( entry && entry->IsPower() )
308  {
309  m_FieldsBuf[VALUE].SetText( sel.LibId.GetLibItemName() );
311 
312  if( s_SelectedRow == VALUE )
314  }
315 
316 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
bool IsPower() const
std::vector< COMPONENT_SELECTION > HISTORY_LIST
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
Define a library symbol object.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
void copySelectedFieldToPanel()
Sets the values displayed on the panel according to the currently selected field row.
COMPONENT_SELECTION SelectComponentFromLibrary(const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Function SelectComponentFromLib Calls the library viewer to select component to import into schematic...
Definition: getpart.cpp:101
#define VALUE
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSizeFieldsList ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 1268 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl.

Referenced by setRowItem().

1269 {
1270  int newWidth = event.GetSize().GetX();
1271  fieldListCtrl->SetColumnWidth( 1, newWidth - fieldListCtrl->GetColumnWidth( 0 ) );
1272  event.Skip();
1273 }
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 255 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::chipnameTextCtrl, DisplayError(), DisplayInfoMessage(), numEval::Parse(), and KIWAY_HOLDER::Prj().

Referenced by setRowItem().

256 {
257  LIB_ID id;
258  wxString msg;
259  wxString partname = chipnameTextCtrl->GetValue();
260 
261  if( id.Parse( partname ) != -1 || !id.IsValid() )
262  {
263  msg.Printf( _( "\"%s\" is not a valid library symbol identifier." ), partname );
264  DisplayError( this, msg );
265  return;
266  }
267 
268  LIB_ALIAS* alias = NULL;
269 
270  try
271  {
272  alias = Prj().SchSymbolLibTable()->LoadSymbol( id );
273  }
274  catch( ... )
275  {
276  }
277 
278  if( !alias )
279  {
280  msg.Printf( _( "Symbol \"%s\" not found in library \"%s\"" ),
281  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
282  DisplayError( this, msg );
283  return;
284  }
285 
286  msg.Printf( _( "Symbol \"%s\" found in library \"%s\"" ),
287  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
288 
289  DisplayInfoMessage( this, msg );
290 }
Part library alias object definition.
void Parse(void *yyp, int yymajor, ParseTOKENTYPE yyminorParseARG_PDECL)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:216
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_FOOTPRINT_FP_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_FOOTPRINT_FP_EDITOR::Edit3DShapeFileName(), DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), and DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 1191 of file dialog_edit_component_in_schematic.cpp.

References CMP_NORMAL, DATASHEET, SCH_COMPONENT::Draw(), DIALOG_SHIM::EndQuasiModal(), FOOTPRINT, g_XorMode, EDA_DRAW_FRAME::GetCanvas(), SCH_COMPONENT::GetField(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), SCH_BASE_FRAME::GetLibPart(), GetParent(), EDA_TEXT::GetTextPos(), GR_DEFAULT_DRAWMODE, SCH_FIELD::ImportValues(), INSTALL_UNBUFFERED_DC, m_cmp, SCH_COMPONENT::m_Pos, SCH_EDIT_FRAME::OnModify(), REFERENCE, SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_COMPONENT::SetOrientation(), EDA_TEXT::SetTextPos(), UR_CHANGED, and VALUE.

Referenced by setRowItem().

1192 {
1193  if( !m_cmp )
1194  return;
1195 
1196  if( LIB_PART* part = GetParent()->GetLibPart( m_cmp->GetLibId() ) )
1197  {
1198  // save old cmp in undo list if not already in edit, or moving ...
1199  if( m_cmp->GetFlags() == 0 )
1201 
1202  INSTALL_UNBUFFERED_DC( dc, GetParent()->GetCanvas() );
1203  m_cmp->Draw( GetParent()->GetCanvas(), &dc, wxPoint( 0, 0 ), g_XorMode );
1204 
1205  // Initialize fixed field values to default values found in library
1206  // Note: the field texts are not modified because they are set in schematic,
1207  // the text from libraries is most of time a dummy text
1208  // Only VALUE, REFERENCE , FOOTPRINT and DATASHEET are re-initialized
1209  LIB_FIELD& refField = part->GetReferenceField();
1210 
1211  m_cmp->GetField( REFERENCE )->ImportValues( refField );
1212  m_cmp->GetField( REFERENCE )->SetTextPos( refField.GetTextPos() + m_cmp->m_Pos );
1213 
1214  LIB_FIELD& valField = part->GetValueField();
1215 
1216  m_cmp->GetField( VALUE )->ImportValues( valField );
1217  m_cmp->GetField( VALUE )->SetTextPos( valField.GetTextPos() + m_cmp->m_Pos );
1218 
1219  LIB_FIELD* field = part->GetField(FOOTPRINT);
1220 
1221  if( field && m_cmp->GetField( FOOTPRINT ) )
1222  {
1223  m_cmp->GetField( FOOTPRINT )->ImportValues( *field );
1224  m_cmp->GetField( FOOTPRINT )->SetTextPos( field->GetTextPos() + m_cmp->m_Pos );
1225  }
1226 
1227  field = part->GetField(DATASHEET);
1228 
1229  if( field && m_cmp->GetField( DATASHEET ) )
1230  {
1231  m_cmp->GetField( DATASHEET )->ImportValues( *field );
1232  m_cmp->GetField( DATASHEET )->SetTextPos( field->GetTextPos() + m_cmp->m_Pos );
1233  }
1234 
1236 
1237  GetParent()->OnModify();
1238 
1239  m_cmp->Draw( GetParent()->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
1240 
1241  EndQuasiModal( wxID_OK );
1242  }
1243 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
name of datasheet
const wxPoint & GetTextPos() const
Definition: eda_text.h:222
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
void ImportValues(const LIB_FIELD &aSource)
Function ImportValues copy parameters from a LIB_FIELD source.
Definition: sch_field.cpp:222
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
Field object used in symbol libraries.
Definition: lib_field.h:59
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:221
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
Define a library symbol object.
void EndQuasiModal(int retCode)
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
#define INSTALL_UNBUFFERED_DC(name, parent)
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
const LIB_ID & GetLibId() const
#define VALUE
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem ( int  aFieldNdx,
const wxString &  aName,
const wxString &  aValue 
)
private

Definition at line 903 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl.

Referenced by addFieldButtonHandler(), copyPanelToSelectedField(), InitBuffers(), moveDownButtonHandler(), moveUpButtonHandler(), OnSelectChipName(), setRowItem(), showButtonHandler(), and updateDisplay().

904 {
905  wxASSERT( aFieldNdx >= 0 );
906 
907  // insert blanks if aFieldNdx is referencing a "yet to be defined" row
908  while( aFieldNdx >= fieldListCtrl->GetItemCount() )
909  {
910  long ndx = fieldListCtrl->InsertItem( fieldListCtrl->GetItemCount(), wxEmptyString );
911 
912  wxASSERT( ndx >= 0 );
913 
914  fieldListCtrl->SetItem( ndx, 1, wxEmptyString );
915  }
916 
917  fieldListCtrl->SetItem( aFieldNdx, 0, aName );
918  fieldListCtrl->SetItem( aFieldNdx, 1, aValue );
919 
920  // recompute the column widths here, after setting texts
921  int totalWidth = fieldListCtrl->GetSize().GetWidth();
922  fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
923  fieldListCtrl->SetColumnWidth( 1, totalWidth - fieldListCtrl->GetColumnWidth( 0 ) );
924 }
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem ( int  aFieldNdx,
const SCH_FIELD aField 
)
inlineprivate

Definition at line 116 of file dialog_edit_component_in_schematic.cpp.

References addFieldButtonHandler(), deleteFieldButtonHandler(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), SCH_FIELD::GetName(), EDA_TEXT::GetText(), MANDATORY_FIELDS, moveDownButtonHandler(), moveUpButtonHandler(), OnCancelButtonClick(), OnCloseDialog(), OnListItemDeselected(), OnListItemSelected(), OnOKButtonClick(), OnSelectChipName(), OnSizeFieldsList(), OnTestChipName(), SetInitCmp(), setRowItem(), showButtonHandler(), and UpdateFields().

117  {
118  // Use default field name for mandatory fields, because they are transalted
119  // according to the current locale
120  wxString f_name;
121 
122  if( aFieldNdx < MANDATORY_FIELDS )
123  f_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( aFieldNdx );
124  else
125  f_name = aField.GetName( false );
126 
127  setRowItem( aFieldNdx, f_name, aField.GetText() );
128  }
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:438
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setSelectedFieldNdx ( int  aFieldNdx)
private

Definition at line 723 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl, m_FieldsBuf, and s_SelectedRow.

Referenced by addFieldButtonHandler(), deleteFieldButtonHandler(), EditSpiceModel(), InitBuffers(), moveDownButtonHandler(), and moveUpButtonHandler().

724 {
725  /* deselect old selection, but I think this is done by single selection
726  * flag within fieldListCtrl.
727  * fieldListCtrl->SetItemState( s_SelectedRow, 0,
728  * wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
729  */
730 
731  if( aFieldNdx >= (int) m_FieldsBuf.size() )
732  aFieldNdx = m_FieldsBuf.size() - 1;
733 
734  if( aFieldNdx < 0 )
735  aFieldNdx = 0;
736 
737  fieldListCtrl->SetItemState( aFieldNdx, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
738  fieldListCtrl->EnsureVisible( aFieldNdx );
739 
740  s_SelectedRow = aFieldNdx;
741 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 118 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_SHIM::IsQuasiModal(), DIALOG_LAYERS_SETUP::OnInitDialog(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

119 {
120  wxSize sz( x, y );
121  SetSize( ConvertDialogToPixels( sz ) );
122 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 146 of file dialog_shim.cpp.

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, max, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), SCH_COMPONENT::SetPosition(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

147 {
148  bool ret;
149  const char* hash_key;
150 
151  if( m_hash_key.size() )
152  {
153  // a special case like EDA_LIST_DIALOG, which has multiple uses.
154  hash_key = m_hash_key.c_str();
155  }
156  else
157  {
158  hash_key = typeid(*this).name();
159  }
160 
161  // Show or hide the window. If hiding, save current position and size.
162  // If showing, use previous position and size.
163  if( show )
164  {
165 #ifndef __WINDOWS__
166  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
167 #endif
168  ret = wxDialog::Show( show );
169 
170  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
171  EDA_RECT savedDialogRect = class_map[ hash_key ];
172 
173  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
174  {
175  SetSize( savedDialogRect.GetPosition().x,
176  savedDialogRect.GetPosition().y,
177  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
178  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
179  0 );
180  }
181 
182  // Be sure that the dialog appears in a visible area
183  // (the dialog position might have been stored at the time when it was
184  // shown on another display)
185  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
186  Centre();
187  }
188  else
189  {
190  // Save the dialog's position & size before hiding, using classname as key
191  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
192 
193 #ifdef __WXMAC__
194  if ( m_eventLoop )
195  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
196 #endif
197 
198  ret = wxDialog::Show( show );
199  }
200 
201  return ret;
202 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:151
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 618 of file dialog_edit_component_in_schematic.cpp.

References DATASHEET, KIWAY_PLAYER::Destroy(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldValueTextCtrl, FOOTPRINT, FRAME_PCB_MODULE_VIEWER_MODAL, GetAssociatedDocument(), getSelectedFieldNdx(), KIWAY_HOLDER::Kiway(), m_FieldsBuf, KIWAY::Player(), ResolveUriByEnvVars(), setRowItem(), and KIWAY_PLAYER::ShowModal().

Referenced by setRowItem().

619 {
620  unsigned fieldNdx = getSelectedFieldNdx();
621 
622  if( fieldNdx == DATASHEET )
623  {
624  wxString datasheet_uri = fieldValueTextCtrl->GetValue();
625  datasheet_uri = ResolveUriByEnvVars( datasheet_uri );
626  GetAssociatedDocument( this, datasheet_uri );
627  }
628  else if( fieldNdx == FOOTPRINT )
629  {
630  // pick a footprint using the footprint picker.
631  wxString fpid = fieldValueTextCtrl->GetValue();
632 
633  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true, this );
634 
635  if( frame->ShowModal( &fpid, this ) )
636  {
637  // DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
638  fieldValueTextCtrl->SetValue( fpid );
639 
640  setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
641  }
642 
643  frame->Destroy();
644  }
645 }
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
name of datasheet
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
const wxString ResolveUriByEnvVars(const wxString &aUri)
Replace any environment variables in file-path uris (leaving network-path URIs alone).
Definition: common.cpp:269
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Field Name Module PCB, i.e. "16DIP300".
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
VTBL_ENTRY bool ShowModal(wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxF...
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 558 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

559 {
560  // This is an exception safe way to zero a pointer before returning.
561  // Yes, even though DismissModal() clears this first normally, this is
562  // here in case there's an exception before the dialog is dismissed.
563  struct NULLER
564  {
565  void*& m_what;
566  NULLER( void*& aPtr ) : m_what( aPtr ) {}
567  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
568  } clear_this( (void*&) m_qmodal_loop );
569 
570  // release the mouse if it's currently captured as the window having it
571  // will be disabled when this dialog is shown -- but will still keep the
572  // capture making it impossible to do anything in the modal dialog itself
573  wxWindow* win = wxWindow::GetCapture();
574  if( win )
575  win->ReleaseMouse();
576 
577  // Get the optimal parent
578  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
579 
580  // Show the optimal parent
581  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
582 
583  wxASSERT_MSG( !m_qmodal_parent_disabler,
584  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
585 
586  // quasi-modal: disable only my "optimal" parent
588 
589 #ifdef __WXMAC__
590  // Apple in its infinite wisdom will raise a disabled window before even passing
591  // us the event, so we have no way to stop it. Instead, we must set an order on
592  // the windows so that the quasi-modal will be pushed in front of the disabled
593  // window when it is raised.
594  ReparentQuasiModal();
595 #endif
596  Show( true );
597 
598  m_qmodal_showing = true;
599 
600  EVENT_LOOP event_loop;
601 
602  m_qmodal_loop = &event_loop;
603 
604  event_loop.Run();
605 
606  m_qmodal_showing = false;
607 
608  return GetReturnCode();
609 }
bool m_qmodal_showing
Definition: dialog_shim.h:155
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::updateDisplay ( )
inlineprivate

Update the listbox showing fields according to the field's text.

This must be called after a text change in fields if this change is not an edition.

Definition at line 163 of file dialog_edit_component_in_schematic.cpp.

References DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldListCtrl, s_SelectedRow, and setRowItem().

Referenced by deleteFieldButtonHandler(), EditSpiceModel(), moveDownButtonHandler(), moveUpButtonHandler(), and UpdateFields().

164  {
165  fieldListCtrl->DeleteAllItems();
166 
167  for( unsigned ii = 0; ii < m_FieldsBuf.size(); ii++ )
168  setRowItem( ii, m_FieldsBuf[ii] );
169  }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
void setRowItem(int aFieldNdx, const wxString &aName, const wxString &aValue)
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFields ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 1246 of file dialog_edit_component_in_schematic.cpp.

References copySelectedFieldToPanel(), SCH_COMPONENT::GetFieldCount(), GetParent(), i, InvokeDialogUpdateFields(), m_cmp, SCH_COMPONENT::m_Fields, m_FieldsBuf, SCH_COMPONENT::m_Pos, and updateDisplay().

Referenced by setRowItem().

1247 {
1248  SCH_COMPONENT copy( *m_cmp );
1249  std::list<SCH_COMPONENT*> components;
1250  components.push_back( &copy );
1251  InvokeDialogUpdateFields( GetParent(), components, false );
1252 
1253  // Copy fields from the modified component copy to the dialog buffer
1254  m_FieldsBuf.clear();
1255 
1256  for( int i = 0; i < copy.GetFieldCount(); ++i )
1257  {
1258  copy.m_Fields[i].SetParent( m_cmp );
1259  m_FieldsBuf.push_back( copy.m_Fields[i] );
1260  m_FieldsBuf[i].Offset( -m_cmp->m_Pos );
1261  }
1262 
1263  // Update the selected field as well
1265  updateDisplay();
1266 }
SCH_FIELDS m_FieldsBuf
a copy of the edited symbol&#39;s SCH_FIELDs
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
int InvokeDialogUpdateFields(SCH_EDIT_FRAME *aCaller, const list< SCH_COMPONENT * > aComponents, bool aCreateUndoEntry)
void updateDisplay()
Update the listbox showing fields according to the field&#39;s text.
size_t i
Definition: json11.cpp:597
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
void copySelectedFieldToPanel()
Sets the values displayed on the panel according to the currently selected field row.
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 132 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_SHIM::IsQuasiModal(), and DIALOG_LAYERS_SETUP::OnInitDialog().

133 {
134  wxSize sz( 0, y );
135  return ConvertDialogToPixels( sz ).y;
136 }

Friends And Related Function Documentation

friend class SCH_EDIT_FRAME
friend

Definition at line 82 of file dialog_edit_component_in_schematic.cpp.

Member Data Documentation

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::convertCheckBox
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldNameLabel
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldNameTextCtrl
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldValueLabel
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::fieldValueTextCtrl
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_buttonSelectChipName
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_buttonTestChipName
protectedinherited
wxRadioBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldHJustifyCtrl
protectedinherited
wxRadioBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_FieldVJustifyCtrl
protectedinherited
bool DIALOG_SHIM::m_fixupsRun
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

std::string DIALOG_SHIM::m_hash_key
protectedinherited
LIB_PART* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_part
private
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 154 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 155 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_skipCopyFromPanel
private
wxStaticLine* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticline1
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextTimeStamp
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnit
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitPosX
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitPosY
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_staticTextUnitSize
protectedinherited
wxRadioBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_StyleRadioBox
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_textCtrlTimeStamp
protectedinherited
wxRadioBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::mirrorRadioBox
protectedinherited
wxRadioBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::orientationRadioBox
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posXLabel
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posXTextCtrl
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posYLabel
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::posYTextCtrl
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::resetFieldsStyleButton
protectedinherited
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::rotateCheckBox
protectedinherited
int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow
staticprivate
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::showCheckBox
protectedinherited
wxStdDialogButtonSizer* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::stdDialogButtonSizer
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::stdDialogButtonSizerCancel
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::textSizeLabel
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::textSizeTextCtrl
protectedinherited
wxChoice* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitChoice
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitsInterchageableLabel
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::unitsInterchageableText
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::updateFieldValues
protectedinherited

The documentation for this class was generated from the following file: