KiCad PCB EDA Suite
dialog_edit_component_in_schematic.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
28 #include <wx/tooltip.h>
29 #include <wx/hyperlink.h>
30 
31 #include <fctsys.h>
32 #include <pgm_base.h>
33 #include <kiway.h>
34 #include <gr_basic.h>
35 #include <class_drawpanel.h>
36 #include <confirm.h>
37 #include <class_sch_screen.h>
38 #include <schframe.h>
39 #include <base_units.h>
40 
41 #include <general.h>
42 #include <sch_base_frame.h>
43 #include <class_library.h>
44 #include <sch_component.h>
45 #include <dialog_helpers.h>
46 #include <sch_validators.h>
47 
49 #ifdef KICAD_SPICE
50 #include <dialog_spice_model.h>
52 #endif /* KICAD_SPICE */
53 
54 
62 {
63 public:
65  DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* aParent );
66 
72  void InitBuffers( SCH_COMPONENT* aComponent );
73 
74 private:
75 
76  friend class SCH_EDIT_FRAME;
77 
82 
83  static int s_SelectedRow;
84 
87 
88  void setSelectedFieldNdx( int aFieldNdx );
89 
90  int getSelectedFieldNdx();
91 
98 
99 
108 
109  void copyOptionsToPanel();
110 
111  void copyPanelToOptions();
112 
113  void setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue );
114 
115  void setRowItem( int aFieldNdx, const SCH_FIELD& aField )
116  {
117  setRowItem( aFieldNdx, aField.GetName( false ), aField.GetText() );
118  }
119 
120  // event handlers
121  void OnCloseDialog( wxCloseEvent& event ) override;
122  void OnListItemDeselected( wxListEvent& event ) override;
123  void OnListItemSelected( wxListEvent& event ) override;
124  void OnCancelButtonClick( wxCommandEvent& event ) override;
125  void OnOKButtonClick( wxCommandEvent& event ) override;
126  void SetInitCmp( wxCommandEvent& event ) override;
127  void addFieldButtonHandler( wxCommandEvent& event ) override;
128  void deleteFieldButtonHandler( wxCommandEvent& event ) override;
129  void moveUpButtonHandler( wxCommandEvent& event ) override;
130  void showButtonHandler( wxCommandEvent& event ) override;
131  void OnTestChipName( wxCommandEvent& event ) override;
132  void OnSelectChipName( wxCommandEvent& event ) override;
133  void OnInitDlg( wxInitDialogEvent& event ) override
134  {
135  TransferDataToWindow();
136 
137  // Now all widgets have the size fixed, call FinishDialogSettings
139  }
140 
141  void EditSpiceModel( wxCommandEvent& event ) override;
142 
143  SCH_FIELD* findField( const wxString& aFieldName );
144 
151  {
152  for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
153  setRowItem( ii, m_FieldsBuf[ii] );
154  }
155 };
156 
157 
159 
160 
162 {
163  wxCHECK_RET( aComponent != NULL && aComponent->Type() == SCH_COMPONENT_T,
164  wxT( "Invalid component object pointer. Bad Programmer!" ) );
165 
167 
169 
170  dlg->InitBuffers( aComponent );
171 
172  // make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
174 
175  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
176  // frame. Therefore this dialog as a modal frame parent, MUST be run under
177  // quasimodal mode for the quasimodal frame support to work. So don't use
178  // the QUASIMODAL macros here.
179  int ret = dlg->ShowQuasiModal();
180 
181  if( m_autoplaceFields )
182  aComponent->AutoAutoplaceFields( GetScreen() );
183 
184  m_canvas->SetIgnoreMouseEvents( false );
186  dlg->Destroy();
187 
188  if( ret == wxID_OK )
189  GetCanvas()->Refresh();
190 }
191 
192 
195 {
196 #ifndef KICAD_SPICE
197  spiceFieldsButton->Hide();
198 #endif /* not KICAD_SPICE */
199 
200  m_parent = (SCH_EDIT_FRAME*) aParent;
201 
202  m_cmp = NULL;
203  m_part = NULL;
204  m_skipCopyFromPanel = false;
205 
206  wxListItem columnLabel;
207 
208  columnLabel.SetImage( -1 );
209 
210  columnLabel.SetText( _( "Name" ) );
211  fieldListCtrl->InsertColumn( 0, columnLabel );
212 
213  columnLabel.SetText( _( "Value" ) );
214  fieldListCtrl->InsertColumn( 1, columnLabel );
215 
219 
220  wxToolTip::Enable( true );
221  stdDialogButtonSizerOK->SetDefault();
222 
223  Fit();
224 }
225 
226 
228 {
229  if( !m_skipCopyFromPanel )
230  {
231  if( !copyPanelToSelectedField() )
232  event.Skip(); // do not go to the next row
233  }
234 }
235 
237 {
238  wxString partname = chipnameTextCtrl->GetValue();
239  LIB_PART* entry = Prj().SchLibs()->FindLibPart( partname );
240 
241  wxString msg;
242 
243  if( entry )
244  {
245  msg.Printf( _( "Component '%s' found in library '%s'" ),
246  GetChars( partname ), GetChars( entry->GetLibraryName() ) );
247  wxMessageBox( msg );
248  return;
249  }
250 
251  msg.Printf( _( "Component '%s' not found in any library" ), GetChars( partname ) );
252 
253  // Try to find components which have a name "near" the current chip name,
254  // i.e. the same name when the comparison is case insensitive.
255  // Could be helpful for old designs when lower cases and upper case were
256  // equivalent.
257  std::vector<LIB_ALIAS*> candidates;
258  Prj().SchLibs()->FindLibraryNearEntries( candidates, partname );
259 
260  if( candidates.size() == 0 )
261  {
262  wxMessageBox( msg );
263  return;
264  }
265 
266  // Some candidates are found. Show them:
267  msg << wxT("\n") << _( "However, some candidates are found:" );
268 
269  // add candidate names:
270  for( unsigned ii = 0; ii < candidates.size(); ii++ )
271  {
272  msg << wxT("\n") <<
273  wxString::Format( _( "'%s' found in library '%s'" ),
274  GetChars( candidates[ii]->GetName() ),
275  GetChars( candidates[ii]->GetLibraryName() ) );
276  }
277 
278  wxMessageBox( msg );
279 }
280 
281 
283 {
285 
286  auto sel = m_parent->SelectComponentFromLibrary( NULL, dummy, true, 0, 0 );
287 
288  if( sel.Name.IsEmpty() )
289  return;
290 
291  chipnameTextCtrl->SetValue( sel.Name );
292 }
293 
294 
296 {
297 #ifdef KICAD_SPICE
298  setSelectedFieldNdx( 0 );
299  DIALOG_SPICE_MODEL dialog( this, *m_cmp, m_FieldsBuf );
300 
301  if( dialog.ShowModal() == wxID_OK )
302  updateDisplay();
303 #endif /* KICAD_SPICE */
304 }
305 
306 
308 {
309  DBG( printf( "OnListItemSelected()\n" ); )
310 
311  // remember the selected row, statically
312  s_SelectedRow = event.GetIndex();
313 
315 }
316 
317 
319 {
320  // On wxWidgets 2.8, and on Linux, calling EndQuasiModal here is mandatory
321  // Otherwise, the main event loop is never restored, and Eeschema does not
322  // respond to any event, because the DIALOG_SHIM destructor is never called.
323  // On wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called,
324  // and calls EndQuasiModal.
325  // therefore calling EndQuasiModal here is not always mandatory but it creates no issues
326  EndQuasiModal( wxID_CANCEL );
327 }
328 
329 
331 {
332  EndQuasiModal( wxID_CANCEL );
333 }
334 
335 
337 {
338  LIB_ID id;
339  wxString tmp = chipnameTextCtrl->GetValue();
340 
341  tmp.Replace( wxT( " " ), wxT( "_" ) );
342 
343  id.SetLibItemName( TO_UTF8( tmp ), false );
344 
345  // Save current flags which could be modified by next change settings
346  STATUS_FLAGS flags = m_cmp->GetFlags();
347 
348  if( id.empty() )
349  {
350  DisplayError( NULL, _( "No Component Name!" ) );
351  }
352  else if( id != m_cmp->GetLibId() )
353  {
354  PART_LIBS* libs = Prj().SchLibs();
355 
356  if( libs->FindLibraryAlias( id ) == NULL )
357  {
358  wxString msg = wxString::Format( _( "Component '%s' not found!" ),
359  GetChars( FROM_UTF8( id.Format() ) ) );
360  DisplayError( this, msg );
361  }
362  else // Change component from lib!
363  {
364  m_cmp->SetLibId( id, libs );
365  }
366  }
367 
368  // For components with multiple shapes (De Morgan representation) Set the selected shape:
369  if( convertCheckBox->IsEnabled() )
370  {
371  m_cmp->SetConvert( convertCheckBox->GetValue() ? 2 : 1 );
372  }
373 
374  //Set the part selection in multiple part per package
375  if( m_cmp->GetUnit() )
376  {
377  int unit_selection = unitChoice->GetCurrentSelection() + 1;
378 
379  m_cmp->SetUnitSelection( &m_parent->GetCurrentSheet(), unit_selection );
380  m_cmp->SetUnit( unit_selection );
381  }
382 
383  switch( orientationRadioBox->GetSelection() )
384  {
385  case 0:
387  break;
388 
389  case 1:
391  break;
392 
393  case 2:
395  break;
396 
397  case 3:
399  break;
400  }
401 
402  int mirror = mirrorRadioBox->GetSelection();
403 
404  switch( mirror )
405  {
406  case 0:
407  break;
408 
409  case 1:
411  break;
412 
413  case 2:
415  break;
416  }
417 
418  // Restore m_Flag modified by SetUnit() and other change settings
419  m_cmp->ClearFlags();
420  m_cmp->SetFlags( flags );
421 }
422 
423 
425 {
426  bool removeRemainingFields = false;
427 
428  if( !copyPanelToSelectedField() )
429  return;
430 
432  {
433  DisplayError( NULL, _( "Illegal reference. A reference must start with a letter" ) );
434  return;
435  }
436 
437  // save old cmp in undo list if not already in edit, or moving ...
438  // or the component to be edited is part of a block
439  if( m_cmp->GetFlags() == 0
442 
444 
445  // Delete any fields with no name before we copy all of m_FieldsBuf back into the component.
446  for( unsigned i = MANDATORY_FIELDS; i<m_FieldsBuf.size(); )
447  {
448  if( m_FieldsBuf[i].GetName( false ).IsEmpty() || m_FieldsBuf[i].GetText().IsEmpty() )
449  {
450  // If a field has no value and is not it the field template list, warn the user
451  // that it will be remove from the component. This gives the user a chance to
452  // correct the problem before removing the undefined fields. It should also
453  // resolve most of the bug reports and questions regarding missing fields.
454  if( !m_FieldsBuf[i].GetName( false ).IsEmpty() && m_FieldsBuf[i].GetText().IsEmpty()
455  && !m_parent->GetTemplates().HasFieldName( m_FieldsBuf[i].GetName( false ) )
456  && !removeRemainingFields )
457  {
458  wxString msg = wxString::Format(
459  _( "The field name <%s> does not have a value and is not defined in "
460  "the field template list. Empty field values are invalid an will "
461  "be removed from the component. Do you wish to remove this and "
462  "all remaining undefined fields?" ),
463  GetChars( m_FieldsBuf[i].GetName( false ) )
464  );
465 
466  wxMessageDialog dlg( this, msg, _( "Remove Fields" ), wxYES_NO | wxNO_DEFAULT );
467 
468  if( dlg.ShowModal() == wxID_NO )
469  return;
470 
471  removeRemainingFields = true;
472  }
473 
474  m_FieldsBuf.erase( m_FieldsBuf.begin() + i );
475  continue;
476  }
477 
478  ++i;
479  }
480 
481  // change all field positions from relative to absolute
482  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
483  {
484  m_FieldsBuf[i].Offset( m_cmp->m_Pos );
485  }
486 
487  LIB_PART* entry = Prj().SchLibs()->FindLibPart( m_cmp->GetLibId() );
488 
489  if( entry && entry->IsPower() )
490  m_FieldsBuf[VALUE].SetText( m_cmp->GetLibId().GetLibItemName() );
491 
492  // copy all the fields back, and change the length of m_Fields.
494 
495  // Reference has a specific initialization, depending on the current active sheet
496  // because for a given component, in a complex hierarchy, there are more than one
497  // reference.
499 
500  m_parent->OnModify();
502 
503  EndQuasiModal( wxID_OK );
504 }
505 
506 
508 {
509  // in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab
510  // screen contents.
511  if( !copyPanelToSelectedField() )
512  return;
513 
514  unsigned fieldNdx = m_FieldsBuf.size();
515 
516  SCH_FIELD blank( wxPoint(), fieldNdx, m_cmp );
517 
518  blank.SetTextAngle( m_FieldsBuf[REFERENCE].GetTextAngle() );
519 
520  m_FieldsBuf.push_back( blank );
521  m_FieldsBuf[fieldNdx].SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ) );
522 
523  m_skipCopyFromPanel = true;
524  setRowItem( fieldNdx, m_FieldsBuf[fieldNdx] );
525 
526  setSelectedFieldNdx( fieldNdx );
527  m_skipCopyFromPanel = false;
528 }
529 
530 
532 {
533  unsigned fieldNdx = getSelectedFieldNdx();
534 
535  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
536  return;
537 
538  if( fieldNdx < MANDATORY_FIELDS )
539  {
540  wxBell();
541  return;
542  }
543 
544  m_skipCopyFromPanel = true;
545  m_FieldsBuf.erase( m_FieldsBuf.begin() + fieldNdx );
546  fieldListCtrl->DeleteItem( fieldNdx );
547 
548  if( fieldNdx >= m_FieldsBuf.size() )
549  --fieldNdx;
550 
551  updateDisplay();
552 
553  setSelectedFieldNdx( fieldNdx );
554  m_skipCopyFromPanel = false;
555 }
556 
557 
559 {
560  unsigned fieldNdx = getSelectedFieldNdx();
561 
562  if( fieldNdx == DATASHEET )
563  {
564  wxString datasheet_uri = fieldValueTextCtrl->GetValue();
565  ::wxLaunchDefaultBrowser( datasheet_uri );
566  }
567  else if( fieldNdx == FOOTPRINT )
568  {
569  // pick a footprint using the footprint picker.
570  wxString fpid;
571 
573 
574  if( frame->ShowModal( &fpid, this ) )
575  {
576  // DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
577  fieldValueTextCtrl->SetValue( fpid );
578 
579  setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
580  }
581 
582  frame->Destroy();
583  }
584 }
585 
586 
588 {
589  unsigned fieldNdx = getSelectedFieldNdx();
590 
591  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
592  return;
593 
594  if( fieldNdx <= MANDATORY_FIELDS )
595  {
596  wxBell();
597  return;
598  }
599 
600  if( !copyPanelToSelectedField() )
601  return;
602 
603  // swap the fieldNdx field with the one before it, in both the vector
604  // and in the fieldListCtrl
605  SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
606 
607  DBG( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
608  TO_UTF8( tmp.GetText() ), TO_UTF8( tmp.GetName( false ) ) ); )
609 
610  m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
611  setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
612 
613  m_FieldsBuf[fieldNdx] = tmp;
614  setRowItem( fieldNdx, tmp );
615 
616  updateDisplay();
617 
618  m_skipCopyFromPanel = true;
619  setSelectedFieldNdx( fieldNdx - 1 );
620  m_skipCopyFromPanel = false;
621 }
622 
623 
625 {
626  /* deselect old selection, but I think this is done by single selection
627  * flag within fieldListCtrl.
628  * fieldListCtrl->SetItemState( s_SelectedRow, 0,
629  * wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
630  */
631 
632  if( aFieldNdx >= (int) m_FieldsBuf.size() )
633  aFieldNdx = m_FieldsBuf.size() - 1;
634 
635  if( aFieldNdx < 0 )
636  aFieldNdx = 0;
637 
638  fieldListCtrl->SetItemState( aFieldNdx, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
639  fieldListCtrl->EnsureVisible( aFieldNdx );
640 
641  s_SelectedRow = aFieldNdx;
642 }
643 
644 
646 {
647  return s_SelectedRow;
648 }
649 
650 
652 {
653  for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
654  {
655  if( aFieldName == m_FieldsBuf[i].GetName( false ) )
656  return &m_FieldsBuf[i];
657  }
658 
659  return NULL;
660 }
661 
662 
664 {
665  m_cmp = aComponent;
666 
667  /* We have 3 component related field lists to be aware of: 1) UI
668  presentation, 2) fields in component ram copy, and 3) fields recorded
669  with component on disk. m_FieldsBuf is the list of UI fields, and this
670  list is not the same as the list which is in the component, which is
671  also not the same as the list on disk. All 3 lists are potentially
672  different. In the UI we choose to preserve the order of the first
673  MANDATORY_FIELDS which are sometimes called fixed fields. Then we append
674  the template fieldnames in the exact same order as the template
675  fieldname editor shows them. Then we append any user defined fieldnames
676  which came from the component.
677  */
678 
679  m_part = Prj().SchLibs()->FindLibPart( m_cmp->GetLibId() );
680 
681 #if 0 && defined(DEBUG)
682  for( int i = 0; i<aComponent->GetFieldCount(); ++i )
683  {
684  printf( "Orig[%d] (x=%d, y=%d)\n", i,
685  aComponent->m_Fields[i].GetTextPos().x,
686  aComponent->m_Fields[i].GetTextPos().y );
687  }
688 
689 #endif
690 
691  // When this code was written, all field constructors ensure that the fixed fields
692  // are all present within a component. So we can knowingly copy them over
693  // in the normal order. Copy only the fixed fields at first.
694  // Please do not break the field constructors.
695 
696  m_FieldsBuf.clear();
697 
698  for( int i=0; i<MANDATORY_FIELDS; ++i )
699  {
700  m_FieldsBuf.push_back( aComponent->m_Fields[i] );
701 
702  // make the editable field position relative to the component
703  m_FieldsBuf[i].Offset( -m_cmp->m_Pos );
704  }
705 
706  // Add template fieldnames:
707  // Now copy in the template fields, in the order that they are present in the
708  // template field editor UI.
710 
711  for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it )
712  {
713  // add a new field unconditionally to the UI only
714  SCH_FIELD fld( wxPoint(0,0), -1 /* id is a relic */, m_cmp, it->m_Name );
715 
716  // See if field by same name already exists in component.
717  SCH_FIELD* schField = aComponent->FindField( it->m_Name );
718 
719  // If the field does not already exist in the component, then we
720  // use defaults from the template fieldname, otherwise the original
721  // values from the component will be set.
722  if( !schField )
723  {
724  if( !it->m_Visible )
725  fld.SetVisible( false );
726  else
727  fld.SetVisible( true );
728 
729  fld.SetText( it->m_Value ); // empty? ok too.
730  }
731  else
732  {
733  fld = *schField;
734 
735  // make the editable field position relative to the component
736  fld.Offset( -m_cmp->m_Pos );
737  }
738 
739  m_FieldsBuf.push_back( fld );
740  }
741 
742  // Lastly, append any original fields from the component which were not added
743  // from the set of fixed fields nor from the set of template fields.
744  for( unsigned i=MANDATORY_FIELDS; i<aComponent->m_Fields.size(); ++i )
745  {
746  SCH_FIELD* cmp = &aComponent->m_Fields[i];
747  SCH_FIELD* buf = findField( cmp->GetName( false ) );
748 
749  if( !buf )
750  {
751  int newNdx = m_FieldsBuf.size();
752  m_FieldsBuf.push_back( *cmp );
753 
754  // make the editable field position relative to the component
755  m_FieldsBuf[newNdx].Offset( -m_cmp->m_Pos );
756  }
757  }
758 
759 
760 #if 0 && defined(DEBUG)
761  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
762  {
763  printf( "m_FieldsBuf[%d] (x=%-3d, y=%-3d) name:%s\n", i, m_FieldsBuf[i].m_Pos.x,
764  m_FieldsBuf[i].m_Pos.y, TO_UTF8(m_FieldsBuf[i].GetName( false ) ) );
765  }
766 #endif
767 
769 
770  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
771  {
772  setRowItem( i, m_FieldsBuf[i] );
773  }
774 
775 #if 0 && defined(DEBUG)
776  for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
777  {
778  printf( "after[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
779  m_FieldsBuf[i].m_Pos.y );
780  }
781 
782 #endif
783 
785 
786  // disable some options inside the edit dialog
787  // which can cause problems while dragging
788  if( m_cmp->IsDragging() )
789  {
790  orientationRadioBox->Disable();
791  mirrorRadioBox->Disable();
792  chipnameTextCtrl->Disable();
793  }
794 
795  // put focus on the list ctrl
796  fieldListCtrl->SetFocus();
797 
798  // resume editing at the last row edited, last time dialog was up.
800 
802 }
803 
804 
805 void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue )
806 {
807  wxASSERT( aFieldNdx >= 0 );
808 
809  // insert blanks if aFieldNdx is referencing a "yet to be defined" row
810  while( aFieldNdx >= fieldListCtrl->GetItemCount() )
811  {
812  long ndx = fieldListCtrl->InsertItem( fieldListCtrl->GetItemCount(), wxEmptyString );
813 
814  wxASSERT( ndx >= 0 );
815 
816  fieldListCtrl->SetItem( ndx, 1, wxEmptyString );
817  }
818 
819  fieldListCtrl->SetItem( aFieldNdx, 0, aName );
820  fieldListCtrl->SetItem( aFieldNdx, 1, aValue );
821 
822  // recompute the column widths here, after setting texts
823  fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
824  fieldListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
825 }
826 
827 
829 {
830  wxCHECK_RET( m_cmp != NULL, wxT( "Component pointer not initialized." ) );
831 
832  unsigned fieldNdx = getSelectedFieldNdx();
833 
834  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
835  return;
836 
837  SCH_FIELD& field = m_FieldsBuf[fieldNdx];
838 
839  showCheckBox->SetValue( field.IsVisible() );
840 
841  rotateCheckBox->SetValue( field.GetTextAngle() == TEXT_ANGLE_VERT );
842 
843  int style = 0;
844 
845  if( field.IsItalic() )
846  style = 1;
847 
848  if( field.IsBold() )
849  style |= 2;
850 
851  m_StyleRadioBox->SetSelection( style );
852 
853  // Select the right text justification
854  if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
855  m_FieldHJustifyCtrl->SetSelection( 0 );
856  else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
857  m_FieldHJustifyCtrl->SetSelection( 2 );
858  else
859  m_FieldHJustifyCtrl->SetSelection( 1 );
860 
861  if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
862  m_FieldVJustifyCtrl->SetSelection( 0 );
863  else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
864  m_FieldVJustifyCtrl->SetSelection( 2 );
865  else
866  m_FieldVJustifyCtrl->SetSelection( 1 );
867 
868 
869  fieldNameTextCtrl->SetValue( field.GetName( false ) );
870 
871  // the names of the fixed fields are not editable, others are.
872  fieldNameTextCtrl->Enable( fieldNdx >= MANDATORY_FIELDS );
873  fieldNameTextCtrl->SetEditable( fieldNdx >= MANDATORY_FIELDS );
874 
875  // only user defined fields may be moved, and not the top most user defined
876  // field since it would be moving up into the fixed fields, > not >=
877  moveUpButton->Enable( fieldNdx > MANDATORY_FIELDS );
878 
879  // may only delete user defined fields
880  deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
881 
882  fieldValueTextCtrl->SetValidator( SCH_FIELD_VALIDATOR( false, field.GetId() ) );
883  fieldValueTextCtrl->SetValue( field.GetText() );
884 
885  m_show_datasheet_button->Enable( fieldNdx == DATASHEET || fieldNdx == FOOTPRINT );
886 
887  if( fieldNdx == DATASHEET )
888  {
889  m_show_datasheet_button->SetLabel( _( "Show Datasheet" ) );
890  m_show_datasheet_button->SetToolTip(
891  _("If your datasheet is given as an http:// link,"
892  " then pressing this button should bring it up in your webbrowser.") );
893  }
894  else if( fieldNdx == FOOTPRINT )
895  {
896  m_show_datasheet_button->SetLabel( _( "Browse Footprints" ) );
897  m_show_datasheet_button->SetToolTip(
898  _("Open the footprint browser to choose a footprint and assign it.") );
899  }
900  else
901  {
902  m_show_datasheet_button->SetLabel( wxEmptyString );
903  m_show_datasheet_button->SetToolTip(
904  _("Used only for fields Footprint and Datasheet.") );
905  }
906 
907  // For power symbols, the value is NOR editable, because value and pin
908  // name must be same and can be edited only in library editor
909  if( fieldNdx == VALUE && m_part && m_part->IsPower() )
910  fieldValueTextCtrl->Enable( false );
911  else
912  fieldValueTextCtrl->Enable( true );
913 
915 
916  wxPoint coord = field.GetTextPos();
917  wxPoint zero = -m_cmp->m_Pos; // relative zero
918 
919  // If the field value is empty and the position is at relative zero, we
920  // set the initial position as a small offset from the ref field, and
921  // orient it the same as the ref field. That is likely to put it at least
922  // close to the desired position.
923  if( coord == zero && field.GetText().IsEmpty() )
924  {
925  rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetTextAngle() == TEXT_ANGLE_VERT );
926 
927  coord.x = m_FieldsBuf[REFERENCE].GetTextPos().x
928  + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
929 
930  coord.y = m_FieldsBuf[REFERENCE].GetTextPos().y
931  + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
932 
933  // coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
934  // That is ok, we basically don't want all the new empty fields on
935  // top of each other.
936  }
937 
938  wxString coordText = StringFromValue( g_UserUnit, coord.x );
939  posXTextCtrl->SetValue( coordText );
940 
941  coordText = StringFromValue( g_UserUnit, coord.y );
942  posYTextCtrl->SetValue( coordText );
943 }
944 
945 
947 {
948  unsigned fieldNdx = getSelectedFieldNdx();
949 
950  if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
951  return true;
952 
953  // Check for illegal field text.
954  if( fieldValueTextCtrl->GetValidator()
955  && !fieldValueTextCtrl->GetValidator()->Validate( this ) )
956  return false;
957 
958  SCH_FIELD& field = m_FieldsBuf[fieldNdx];
959 
960  field.SetVisible( showCheckBox->GetValue() );
961 
962  if( rotateCheckBox->GetValue() )
963  field.SetTextAngle( TEXT_ANGLE_VERT );
964  else
966 
967  rotateCheckBox->SetValue( field.GetTextAngle() == TEXT_ANGLE_VERT );
968 
969  // Copy the text justification
970  static const EDA_TEXT_HJUSTIFY_T hjustify[] = {
974  };
975 
976  static const EDA_TEXT_VJUSTIFY_T vjustify[] = {
980  };
981 
982  field.SetHorizJustify( hjustify[m_FieldHJustifyCtrl->GetSelection()] );
983  field.SetVertJustify( vjustify[m_FieldVJustifyCtrl->GetSelection()] );
984 
985  field.SetName( fieldNameTextCtrl->GetValue() );
986 
987  /* Void fields texts for REFERENCE and VALUE (value is the name of the
988  * component in lib ! ) are not allowed
989  * change them only for a new non void value
990  * When void, usually netlists are broken
991  */
992  if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE )
993  field.SetText( fieldValueTextCtrl->GetValue() );
994 
995  setRowItem( fieldNdx, field ); // update fieldListCtrl
996 
998  field.SetTextSize( wxSize( tmp, tmp ) );
999  int style = m_StyleRadioBox->GetSelection();
1000 
1001  field.SetItalic( (style & 1 ) != 0 );
1002  field.SetBold( (style & 2 ) != 0 );
1003 
1004  wxPoint pos;
1005  pos.x = ValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
1006  pos.y = ValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
1007  field.SetTextPos( pos );
1008 
1009  return true;
1010 }
1011 
1012 
1014 {
1015  // Remove non existing choices (choiceCount must be <= number for parts)
1016  int unitcount = m_part ? m_part->GetUnitCount() : 1;
1017 
1018  if( unitcount < 1 )
1019  unitcount = 1;
1020 
1021  unitChoice->Clear();
1022 
1023  for( int ii = 1; ii <= unitcount; ii++ )
1024  {
1025  unitChoice->Append( LIB_PART::SubReference( ii, false ) );
1026  }
1027 
1028  // For components with multiple parts per package, set the unit selection
1029  if( m_cmp->GetUnit() <= (int)unitChoice->GetCount() )
1030  unitChoice->SetSelection( m_cmp->GetUnit() - 1 );
1031 
1032  // Disable unit selection if only one unit exists:
1033  if( m_cmp->GetUnitCount() <= 1 )
1034  {
1035  unitChoice->Enable( false );
1036  unitsInterchageableLabel->Show( false );
1037  unitsInterchageableText->Show( false );
1038  }
1039  else
1040  {
1041  // Show the "Units are not interchangeable" message option?
1042  if( !m_part || !m_part->UnitsLocked() )
1043  unitsInterchageableLabel->SetLabel( _( "Yes" ) );
1044  else
1045  unitsInterchageableLabel->SetLabel( _( "No" ) );
1046  }
1047 
1048  int orientation = m_cmp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
1049 
1050  if( orientation == CMP_ORIENT_90 )
1051  orientationRadioBox->SetSelection( 1 );
1052  else if( orientation == CMP_ORIENT_180 )
1053  orientationRadioBox->SetSelection( 2 );
1054  else if( orientation == CMP_ORIENT_270 )
1055  orientationRadioBox->SetSelection( 3 );
1056  else
1057  orientationRadioBox->SetSelection( 0 );
1058 
1059  int mirror = m_cmp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );
1060 
1061  if( mirror == CMP_MIRROR_X )
1062  {
1063  mirrorRadioBox->SetSelection( 1 );
1064  DBG( printf( "mirror=X,1\n" ); )
1065  }
1066  else if( mirror == CMP_MIRROR_Y )
1067  {
1068  mirrorRadioBox->SetSelection( 2 );
1069  DBG( printf( "mirror=Y,2\n" ); )
1070  }
1071  else
1072  mirrorRadioBox->SetSelection( 0 );
1073 
1074  // Activate/Desactivate the normal/convert option ? (activated only if
1075  // the component has more than one shape)
1076  if( m_cmp->GetConvert() > 1 )
1077  convertCheckBox->SetValue( true );
1078 
1079  if( m_part == NULL || !m_part->HasConversion() )
1080  convertCheckBox->Enable( false );
1081 
1082  // Set the component's library name.
1083  chipnameTextCtrl->SetValue( FROM_UTF8( m_cmp->GetLibId().Format() ) );
1084 
1085  // Set the component's unique ID time stamp.
1086  m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ),
1087  (unsigned long) m_cmp->GetTimeStamp() ) );
1088 }
1089 
1090 
1091 #include <kicad_device_context.h>
1092 
1093 
1095 {
1096  if( !m_cmp )
1097  return;
1098 
1099  if( LIB_PART* part = Prj().SchLibs()->FindLibPart( m_cmp->GetLibId() ) )
1100  {
1101  // save old cmp in undo list if not already in edit, or moving ...
1102  if( m_cmp->GetFlags() == 0 )
1104 
1106  m_cmp->Draw( m_parent->GetCanvas(), &dc, wxPoint( 0, 0 ), g_XorMode );
1107 
1108  // Initialize fixed field values to default values found in library
1109  // Note: the field texts are not modified because they are set in schematic,
1110  // the text from libraries is most of time a dummy text
1111  // Only VALUE, REFERENCE , FOOTPRINT and DATASHEET are re-initialized
1112  LIB_FIELD& refField = part->GetReferenceField();
1113 
1114  m_cmp->GetField( REFERENCE )->SetTextPos( refField.GetTextPos() + m_cmp->m_Pos );
1115  m_cmp->GetField( REFERENCE )->ImportValues( refField );
1116 
1117  LIB_FIELD& valField = part->GetValueField();
1118 
1119  m_cmp->GetField( VALUE )->SetTextPos( valField.GetTextPos() + m_cmp->m_Pos );
1120  m_cmp->GetField( VALUE )->ImportValues( valField );
1121 
1122  LIB_FIELD* field = part->GetField(FOOTPRINT);
1123 
1124  if( field && m_cmp->GetField( FOOTPRINT ) )
1125  {
1126  m_cmp->GetField( FOOTPRINT )->SetTextPos( field->GetTextPos() + m_cmp->m_Pos );
1127  m_cmp->GetField( FOOTPRINT )->ImportValues( *field );
1128  }
1129 
1130  field = part->GetField(DATASHEET);
1131 
1132  if( field && m_cmp->GetField( DATASHEET ) )
1133  {
1134  m_cmp->GetField( DATASHEET )->SetTextPos( field->GetTextPos() + m_cmp->m_Pos );
1135  m_cmp->GetField( DATASHEET )->ImportValues( *field );
1136  }
1137 
1139 
1140  m_parent->OnModify();
1141 
1142  m_cmp->Draw( m_parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
1143 
1144  EndQuasiModal( wxID_OK );
1145  }
1146 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:156
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
#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's value...
Definition: sch_field.h:56
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:229
bool UnitsLocked() const
void EditComponent(SCH_COMPONENT *aComponent)
Function EditComponent displays the edit component dialog to edit the parameters of aComponent...
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Function AutoAutoplaceFields Autoplace fields only if correct to do so automatically.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
bool copyPanelToSelectedField()
Function copyPanelToSelectedField copies the values displayed on the panel fields to the currently se...
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:473
const TEMPLATES & GetTemplates()
Function GetTemplates returns the field names template for read only access.
Definition: schframe.h:337
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
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
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
int GetOrientation()
Function GetOrientation Used to display component orientation (in dialog editor or info) ...
SCH_FIELDS m_FieldsBuf
a copy of the edited component's SCH_FIELDs
SCH_FIELD * findField(const wxString &aFieldName)
bool IsItalic() const
Definition: eda_text.h:170
bool IsPower() const
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
void OnOKButtonClick(wxCommandEvent &event) override
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:761
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
int GetId() const
Definition: sch_field.h:87
void ImportValues(const LIB_FIELD &aSource)
Function ImportValues copy parameters from a LIB_FIELD source.
Definition: sch_field.cpp:221
void addFieldButtonHandler(wxCommandEvent &event) override
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:203
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void SetItalic(bool isItalic)
Definition: eda_text.h:169
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
void OnInitDlg(wxInitDialogEvent &event) override
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
int GetTextWidth() const
Definition: eda_text.h:218
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void SetVisible(bool aVisible)
Definition: eda_text.h:175
void OnCancelButtonClick(wxCommandEvent &event) override
static int ParseSize(const wxString &sizeText, EDA_UNITS_T user_unit)
Definition: wxwineda.cpp:123
std::vector< COMPONENT_SELECTION > HISTORY_LIST
SCH_FIELD * FindField(const wxString &aFieldName)
Function FindField searches for SCH_FIELD with aFieldName and returns it if found, else NULL.
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
void SetRef(const SCH_SHEET_PATH *sheet, const wxString &ref)
Set the reference, for the given sheet path.
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
void SetUnitSelection(SCH_SHEET_PATH *aSheet, int aUnitSelection)
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:214
int GetUnitCount() const
Function GetUnitCount returns the number of parts per package of the component.
void deleteFieldButtonHandler(wxCommandEvent &event) override
Class LIB_ID.
Definition: lib_id.h:56
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
#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:173
double GetTextAngle() const
Definition: eda_text.h:164
void SetConvert(int aConvert)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:520
#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)
int GetConvert() const
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 OnTestChipName(wxCommandEvent &event) override
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, KIWAY_PLAYER *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:302
a helper to handle the real device context used in KiCad
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString)
Function EnsureTextCtrlWidth sets the minimum pixel width on a text control in order to make a text s...
Definition: common.cpp:108
std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetFields(const SCH_FIELDS &aFields)
SCH_FIELD * GetField(int aFieldNdx) const
Function GetField returns a field.
Definitions for the Eeschema program SCH_SCREEN class.
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
int ShowQuasiModal()
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_component.h:52
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:194
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:479
Defintions of control validators for schematic dialogs.
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:565
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:368
Class LIB_PART defines a library part object.
void OnListItemDeselected(wxListEvent &event) override
Helper dialog and control classes.
unsigned STATUS_FLAGS
Definition: base_struct.h:144
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
void SetUnit(int aUnit)
change the unit id to aUnit has maening only for multiple parts per package Also set the modified fla...
int GetUnit() const
void OnListItemSelected(wxListEvent &event) override
bool m_autoplaceFields
automatically place component fields
Definition: schframe.h:154
const wxString GetLibraryName()
time_t GetTimeStamp() const
Definition: base_struct.h:204
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:54
int GetUnitCount() const
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void OnSelectChipName(wxCommandEvent &event) override
Class PART_LIBS is a collection of PART_LIBs.
Field Value of part, i.e. "3.3K".
void moveUpButtonHandler(wxCommandEvent &event) override
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void EndQuasiModal(int retCode)
#define GR_DEFAULT_DRAWMODE
Definition: general.h:69
const wxString GetRef(const SCH_SHEET_PATH *sheet)
Function GetRef returns the reference, for the given sheet path.
Definition the SCH_COMPONENT class for Eeschema.
Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP.
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
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Function GetTemplateFieldName returns a template field names list for read only access.
Definition: schframe.h:327
see class PGM_BASE
void updateDisplay()
Function updateDisplay update the listbox showing fields, according to the fields texts must be calle...
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
int GetFieldCount() const
Function GetFieldCount returns the number of fields in this component.
BLOCK_STATE_T GetState() const
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 SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:193
#define INSTALL_UNBUFFERED_DC(name, parent)
bool IsVisible() const
Definition: eda_text.h:176
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(wxWindow *aParent)
Constructor.
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:911
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Virtual function, from the base class SCH_ITEM::Draw.
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMA...
void SetIgnoreMouseEvents(bool aIgnore)
void SetName(const wxString &aName)
Definition: sch_field.h:85
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Function SubReference.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:68
static bool empty(const wxTextEntryBase *aCtrl)
void EditSpiceModel(wxCommandEvent &event) override
const LIB_ID & GetLibId() const
void copySelectedFieldToPanel()
Function copySelectedFieldToPanel sets the values displayed on the panel according to the currently s...
UTF8 Format() const
Function Format.
Definition: lib_id.cpp:263
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
#define DBG(x)
Definition: fctsys.h:33
void InitBuffers(SCH_COMPONENT *aComponent)
Function InitBuffers sets up to edit the given component.
COMPONENT_SELECTION SelectComponentFromLibrary(const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, const wxString &aHighlight=wxEmptyString, bool aAllowFields=true)
Function SelectComponentFromLib Calls the library viewer to select component to import into schematic...
Definition: getpart.cpp:98
class SCH_FILED_VALIDATOR
Definition for part library class.
void showButtonHandler(wxCommandEvent &event) override
static bool IsReferenceStringValid(const wxString &aReferenceString)
Function IsReferenceStringValid (static) Tests for an acceptable reference string An acceptable refer...
void setRowItem(int aFieldNdx, const SCH_FIELD &aField)
void SetBold(bool aBold)
Definition: eda_text.h:172
static wxString FormatSize(EDA_UNITS_T user_unit, int textSize)
Function FormatSize formats a string containing the size in the desired units.
Definition: wxwineda.cpp:84
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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...
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
void SetOrientation(int aOrientation)
Function SetOrientation computes the new transform matrix based on aOrientation for the component whi...
bool IsDragging() const
Definition: base_struct.h:219