KiCad PCB EDA Suite
dialog_change_symbols.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) 2020 CERN
5  *
6  * @author Wayne Stambaugh <stambaughw@gmail.com>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <algorithm>
23 
24 #include <bitmaps.h>
25 #include <kicad_string.h> // WildCompareString
26 #include <kiway.h>
27 #include <lib_id.h>
28 
29 #include <core/kicad_algo.h>
30 #include <dialog_change_symbols.h>
31 #include <sch_component.h>
32 #include <sch_edit_frame.h>
33 #include <sch_screen.h>
34 #include <sch_sheet_path.h>
35 #include <schematic.h>
36 #include <template_fieldnames.h>
37 #include <wx_html_report_panel.h>
38 
39 
40 bool g_removeExtraFields = false;
41 bool g_resetEmptyFields = false;
43 bool g_resetFieldEffects = false;
44 bool g_resetFieldPositions = false;
45 
46 
48  MODE aMode ) :
49  DIALOG_CHANGE_SYMBOLS_BASE( aParent ),
50  m_symbol( aSymbol),
51  m_mode( aMode )
52 {
53  wxASSERT( aParent );
54 
55  if( m_mode == MODE::UPDATE )
56  {
57  m_newIdSizer->Show( false );
58  }
59  else
60  {
61  m_matchAll->SetLabel( _( "Change all symbols in schematic" ) );
62  SetTitle( _( "Change Symbols" ) );
63  m_matchSizer->FindItem( m_matchAll )->Show( false );
64  }
65 
66  if( m_symbol )
67  {
68  SCH_SHEET_PATH* currentSheet = &aParent->Schematic().CurrentSheet();
69 
70  if( m_mode == MODE::CHANGE )
71  m_matchBySelection->SetLabel( _( "Change selected Symbol" ) );
72 
73  m_newId->AppendText( FROM_UTF8( m_symbol->GetLibId().Format().c_str() ) );
74  m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) );
75  m_specifiedValue->ChangeValue( m_symbol->GetValue( currentSheet ) );
76  m_specifiedId->ChangeValue( FROM_UTF8( m_symbol->GetLibId().Format().c_str() ) );
77  }
78  else
79  {
80  m_matchSizer->FindItem( m_matchBySelection )->Show( false );
81  }
82 
85 
86  if( m_mode == MODE::CHANGE )
87  {
88  m_matchByReference->SetLabel( _( "Change symbols matching reference designator:" ) );
89  m_matchByValue->SetLabel( _( "Change symbols matching value:" ) );
90  m_matchById->SetLabel( _( "Change symbols matching library identifier:" ) );
91  }
92 
93  m_matchSizer->SetEmptyCellSize( wxSize( 0, 0 ) );
94  m_matchSizer->Layout();
95 
96  for( int i = 0; i < MANDATORY_FIELDS; ++i )
97  {
99 
100  if( i != REFERENCE && i != VALUE )
101  m_fieldsBox->Check( i, true );
102  }
103 
105 
106  m_messagePanel->SetLazyUpdate( true );
107 
108  if( aSymbol && aSymbol->IsSelected() )
109  {
110  m_matchBySelection->SetValue( true );
111  }
112  else
113  {
114  if( aMode == MODE::UPDATE )
115  m_matchAll->SetValue( true );
116  else
117  m_matchByReference->SetValue( true );
118  }
119 
120  if( m_mode == MODE::CHANGE )
121  {
122  m_updateFieldsSizer->GetStaticBox()->SetLabel( _( "Update Fields") );
123  m_removeExtraBox->SetLabel( _( "Remove fields if not in new symbol" ) );
124  m_resetEmptyFields->SetLabel( _( "Reset fields if empty in new symbol" ) );
125  m_resetFieldVisibilities->SetLabel( _( "Update field visibilities" ) );
126  m_resetFieldEffects->SetLabel( _( "Update field sizes and styles" ) );
127  m_resetFieldPositions->SetLabel( _( "Update field positions" ) );
128  }
129 
135 
136  // DIALOG_SHIM needs a unique hash_key because classname is not sufficient
137  // because the update and change versions of this dialog have different controls.
138  m_hash_key = TO_UTF8( GetTitle() );
139 
140  // Ensure m_closeButton (with id = wxID_CANCEL) has the right label
141  // (to fix automatic renaming of button label )
142  m_sdbSizerCancel->SetLabel( _( "Close" ) );
143 
144  if( m_mode == MODE::CHANGE )
145  m_sdbSizerOK->SetLabel( _( "Change" ) );
146  else
147  m_sdbSizerOK->SetLabel( _( "Update" ) );
148 
149  m_sdbSizerOK->SetDefault();
150 
151  // Now all widgets have the size fixed, call FinishDialogSettings
153 }
154 
155 
156 void DIALOG_CHANGE_SYMBOLS::onMatchByAll( wxCommandEvent& aEvent )
157 {
159 }
160 
161 
162 void DIALOG_CHANGE_SYMBOLS::onMatchBySelected( wxCommandEvent& aEvent )
163 {
165 }
166 
167 
168 void DIALOG_CHANGE_SYMBOLS::onMatchByReference( wxCommandEvent& aEvent )
169 {
171  m_specifiedReference->SetFocus();
172 }
173 
174 
175 void DIALOG_CHANGE_SYMBOLS::onMatchByValue( wxCommandEvent& aEvent )
176 {
178  m_specifiedValue->SetFocus();
179 }
180 
181 
182 void DIALOG_CHANGE_SYMBOLS::onMatchById( wxCommandEvent& aEvent )
183 {
185  m_specifiedId->SetFocus();
186 }
187 
188 
190 {
192 }
193 
194 
196 {
202 }
203 
204 
206 {
207  wxString newName = m_specifiedId->GetValue();
208 
209  KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true );
210 
211  if( frame->ShowModal( &newName, this ) )
212  {
213  m_specifiedId->SetValue( newName );
215  }
216 
217  frame->Destroy();
218 }
219 
220 
222 {
223  wxString newName = m_newId->GetValue();
224 
225  KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true );
226 
227  if( frame->ShowModal( &newName, this ) )
228  {
229  m_newId->SetValue( newName );
231  }
232 
233  frame->Destroy();
234 }
235 
236 
238 {
239  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
240 
241  wxCHECK( frame, /* void */ );
242 
243  LIB_ID newId;
244  SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
245 
246  if( m_mode == MODE::CHANGE )
247  {
248  newId.Parse( m_newId->GetValue(), LIB_ID::ID_SCH );
249 
250  if( !newId.IsValid() )
251  return;
252  }
253 
254  // Load new non-mandatory fields from the library parts of all matching symbols
255  std::set<wxString> fieldNames;
256 
257  for( SCH_SHEET_PATH& instance : hierarchy )
258  {
259  SCH_SCREEN* screen = instance.LastScreen();
260 
261  wxCHECK2( screen, continue );
262 
263  for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
264  {
265  SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
266 
267  wxCHECK2( symbol, continue );
268 
269  if( !isMatch( symbol, &instance ) )
270  continue;
271 
272  LIB_PART* libSymbol = frame->GetLibPart( symbol->GetLibId() );
273 
274  if( !libSymbol )
275  continue;
276 
277  std::unique_ptr<LIB_PART> flattenedSymbol = libSymbol->Flatten();
278 
279  LIB_FIELDS libFields;
280  flattenedSymbol->GetFields( libFields );
281 
282  for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
283  fieldNames.insert( libFields[i].GetName() );
284  }
285  }
286 
287  // Update the listbox widget
288  for( unsigned i = m_fieldsBox->GetCount() - 1; i >= MANDATORY_FIELDS; --i )
289  m_fieldsBox->Delete( i );
290 
291  for( const wxString& fieldName : fieldNames )
292  m_fieldsBox->Append( fieldName );
293 
294  for( unsigned i = MANDATORY_FIELDS; i < m_fieldsBox->GetCount(); ++i )
295  m_fieldsBox->Check( i, true );
296 }
297 
298 
300 {
301  for( unsigned i = 0; i < m_fieldsBox->GetCount(); ++i )
302  m_fieldsBox->Check( i, aCheck );
303 }
304 
305 
306 void DIALOG_CHANGE_SYMBOLS::onOkButtonClicked( wxCommandEvent& aEvent )
307 {
308  wxBusyCursor dummy;
309  SCH_EDIT_FRAME* parent = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
310 
311  wxCHECK( parent, /* void */ );
312 
314  m_messagePanel->Flush( false );
315 
316  // Create the set of fields to be updated
317  m_updateFields.clear();
318 
319  for( unsigned i = 0; i < m_fieldsBox->GetCount(); ++i )
320  {
321  if( m_fieldsBox->IsChecked( i ) )
322  m_updateFields.insert( m_fieldsBox->GetString( i ) );
323  }
324 
325  if( processMatchingSymbols() )
326  {
327  parent->TestDanglingEnds(); // This will also redraw the changed symbols.
328  parent->OnModify();
329  }
330 
331  m_messagePanel->Flush( false );
332 }
333 
334 
336 {
337  LIB_ID id;
338 
339  wxCHECK( aSymbol, false );
340 
341  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
342 
343  wxCHECK( frame, false );
344 
345  if( m_matchAll->GetValue() )
346  {
347  return true;
348  }
349  else if( m_matchBySelection->GetValue() )
350  {
351  return aSymbol == m_symbol;
352  }
353  else if( m_matchByReference->GetValue() )
354  {
355  return WildCompareString( m_specifiedReference->GetValue(), aSymbol->GetRef( aInstance ),
356  false );
357  }
358  else if( m_matchByValue->GetValue() )
359  {
360  return WildCompareString( m_specifiedValue->GetValue(), aSymbol->GetValue( aInstance ),
361  false );
362  }
363  else if( m_matchById )
364  {
365  id.Parse( m_specifiedId->GetValue(), LIB_ID::ID_SCH );
366  return aSymbol->GetLibId() == id;
367  }
368 
369  return false;
370 }
371 
372 
374 {
375  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
376 
377  wxCHECK( frame, false );
378 
379  LIB_ID newId;
380  bool appendToUndo = false;
381  bool changed = false;
382  SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
383 
384  if( m_mode == MODE::CHANGE )
385  {
386  newId.Parse( m_newId->GetValue(), LIB_ID::ID_SCH );
387 
388  if( !newId.IsValid() )
389  return false;
390  }
391 
392  // Use map as a cheap and dirty way to ensure library symbols are not updated multiple
393  // times in complex hierachies.
394  std::map<SCH_COMPONENT*, SCH_SCREEN*> symbolsToProcess;
395 
396  for( SCH_SHEET_PATH& instance : hierarchy )
397  {
398  SCH_SCREEN* screen = instance.LastScreen();
399 
400  wxCHECK2( screen, continue );
401 
402  for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
403  {
404  SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
405 
406  wxCHECK2( symbol, continue );
407 
408  if( !isMatch( symbol, &instance ) )
409  continue;
410 
411  // Shared symbols always have identical library symbols so don't add duplicates.
412  symbolsToProcess[symbol] = screen;
413  }
414  }
415 
416  for( auto i : symbolsToProcess )
417  {
418  SCH_COMPONENT* symbol = i.first;
419 
420  if( m_mode == MODE::UPDATE )
421  {
422  if( processSymbol( symbol, i.second, symbol->GetLibId(), appendToUndo ) )
423  changed = true;
424  }
425  else
426  {
427  if( processSymbol( symbol, i.second, newId, appendToUndo ) )
428  changed = true;
429  }
430 
431  if( changed )
432  appendToUndo = true;
433  }
434 
435  return changed;
436 }
437 
438 
440  const LIB_ID& aNewId, bool aAppendToUndo )
441 {
442  wxCHECK( aSymbol, false );
443  wxCHECK( aScreen, false );
444  wxCHECK( aNewId.IsValid(), false );
445 
446  SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
447 
448  wxCHECK( frame, false );
449 
450  LIB_ID oldId = aSymbol->GetLibId();
451  wxString msg;
452  wxString references;
453 
454  for( COMPONENT_INSTANCE_REFERENCE instance : aSymbol->GetInstanceReferences() )
455  {
456  if( references.IsEmpty() )
457  references = instance.m_Reference;
458  else
459  references += " " + instance.m_Reference;
460  }
461 
462  msg.Printf( _( "%s %s \"%s\" from \"%s\" to \"%s\"" ),
463  ( m_mode == MODE::UPDATE ) ? _( "Update" ) : _( "Change" ),
464  ( aSymbol->GetInstanceReferences().size() == 1 ) ? _( "symbol" ) : _( "symbols" ),
465  references,
466  oldId.Format().c_str(),
467  aNewId.Format().c_str() );
468 
469  LIB_PART* libSymbol = frame->GetLibPart( aNewId );
470 
471  if( !libSymbol )
472  {
473  msg << ": " << _( "*** symbol not found ***" );
475  return false;
476  }
477 
478  std::unique_ptr< LIB_PART > flattenedSymbol = libSymbol->Flatten();
479 
480  if( flattenedSymbol->GetUnitCount() < aSymbol->GetUnit() )
481  {
482  msg << ": " << _( "*** new symbol has too few units ***" );
484  return false;
485  }
486 
487  // Removing the symbol needs to be done before the LIB_PART is changed to prevent stale
488  // library symbols in the schematic file.
489  aScreen->Remove( aSymbol );
490  frame->SaveCopyInUndoList( aScreen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );
491 
492  if( aNewId != aSymbol->GetLibId() )
493  aSymbol->SetLibId( aNewId );
494 
495  aSymbol->SetLibSymbol( flattenedSymbol.release() );
496 
497  bool removeExtras = m_removeExtraBox->GetValue();
498  bool resetEmpty = m_resetEmptyFields->GetValue();
499  bool resetVis = m_resetFieldVisibilities->GetValue();
500  bool resetEffects = m_resetFieldEffects->GetValue();
501  bool resetPositions = m_resetFieldPositions->GetValue();
502 
503  for( unsigned i = 0; i < aSymbol->GetFields().size(); ++i )
504  {
505  SCH_FIELD* field = aSymbol->GetField( (int) i ) ;
506  LIB_FIELD* libField = nullptr;
507 
508  if( !alg::contains( m_updateFields, field->GetName() ) )
509  continue;
510 
511  if( i < MANDATORY_FIELDS )
512  libField = libSymbol->GetField( (int) i );
513  else
514  libField = libSymbol->FindField( field->GetName() );
515 
516  if( libField )
517  {
518  if( libField->GetText().IsEmpty() )
519  {
520  if( resetEmpty )
521  field->SetText( wxEmptyString );
522  }
523  else
524  {
525  field->SetText( libField->GetText() );
526  }
527 
528  if( resetVis )
529  field->SetVisible( libField->IsVisible() );
530 
531  if( resetEffects )
532  {
533  // Careful: the visible bit is also in Effects
534  bool visible = field->IsVisible();
535  field->SetEffects( *libField );
536  field->SetVisible( visible );
537  }
538 
539  if( resetPositions )
540  {
541  field->SetTextPos( aSymbol->GetPosition() + libField->GetTextPos() );
542  }
543  }
544  else if( i >= MANDATORY_FIELDS && removeExtras )
545  {
546  aSymbol->RemoveField( field->GetName() );
547  i--;
548  }
549  }
550 
551  LIB_FIELDS libFields;
552  libSymbol->GetFields( libFields );
553 
554  for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
555  {
556  LIB_FIELD& libField = libFields[i];
557 
558  if( !alg::contains( m_updateFields, libField.GetName() ) )
559  continue;
560 
561  if( !aSymbol->FindField( libField.GetName(), false ) )
562  {
563  wxString fieldName = libField.GetCanonicalName();
564  SCH_FIELD newField( wxPoint( 0, 0), aSymbol->GetFieldCount(), aSymbol, fieldName );
565  SCH_FIELD* schField = aSymbol->AddField( newField );
566 
567  schField->SetEffects( libField );
568  schField->SetText( libField.GetText() );
569  schField->SetTextPos( aSymbol->GetPosition() + libField.GetTextPos() );
570  }
571  }
572 
573  aScreen->Append( aSymbol );
574  frame->GetCanvas()->GetView()->Update( aSymbol );
575 
576  msg += ": OK";
578 
579  return true;
580 }
581 
582 
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void SetLazyUpdate(bool aLazyUpdate)
Sets the lasy update.
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:61
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:241
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
void SetLibId(const LIB_ID &aName)
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
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:109
void onMatchByReference(wxCommandEvent &aEvent) override
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:91
bool IsSelected() const
Definition: eda_item.h:192
bool g_removeExtraFields
std::string m_hash_key
Definition: dialog_shim.h:199
bool IsVisible() const
Definition: eda_text.h:192
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
Definition: eda_text.cpp:136
bool g_resetFieldEffects
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
Field object used in symbol libraries.
Definition: lib_field.h:59
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
void Flush(bool aSort=false)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void checkAll(bool aCheck)
Selects or deselects all fields in the listbox widget
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:253
void SetVisible(bool aVisible)
Definition: eda_text.h:191
const wxString GetValue(const SCH_SHEET_PATH *sheet) const
Schematic editor (Eeschema) main window.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Definition: lib_id.h:171
bool g_resetEmptyFields
Field Reference of part, i.e. "IC21".
wxString GetName(bool aUseDefaultName=true) const
Returns the field name.
Definition: lib_field.cpp:365
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
const char * c_str() const
Definition: utf8.h:107
void onMatchByAll(wxCommandEvent &aEvent) override
std::set< wxString > m_updateFields
Set of field names that should have values updated
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:95
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
bool processSymbol(SCH_COMPONENT *aSymbol, SCH_SCREEN *aScreen, const LIB_ID &aNewId, bool aAppendToUndo)
int GetUnit() const
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this part matching aFieldName and returns it or NULL if not found.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:120
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:343
bool g_resetFieldPositions
Class DIALOG_CHANGE_SYMBOLS_BASE.
DIALOG_CHANGE_SYMBOLS(SCH_EDIT_FRAME *aParent, SCH_COMPONENT *aSymbol, MODE aMode=MODE::UPDATE)
A simple container for schematic symbol instance infromation.
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
Definition: string.cpp:488
const std::vector< COMPONENT_INSTANCE_REFERENCE > & GetInstanceReferences()
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
Definition: lib_field.cpp:374
SCHEMATIC & Schematic() const
Define a library symbol object.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void onMatchBySelected(wxCommandEvent &aEvent) override
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const BITMAP_OPAQUE small_library_xpm[1]
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
void launchMatchIdSymbolBrowser(wxCommandEvent &aEvent) override
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
UTF8 Format() const
Definition: lib_id.cpp:237
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
void onMatchByValue(wxCommandEvent &aEvent) override
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
Field Value of part, i.e. "3.3K".
void launchNewIdSymbolBrowser(wxCommandEvent &aEvent) override
void Clear()
clears the report panel
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:129
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
WX_HTML_REPORT_PANEL * m_messagePanel
#define _(s)
Definition: 3d_actions.cpp:33
void onMatchById(wxCommandEvent &aEvent) override
std::vector< LIB_FIELD > LIB_FIELDS
Definition: lib_field.h:218
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:440
bool isMatch(SCH_COMPONENT *aSymbol, SCH_SHEET_PATH *aInstance)
EE_RTREE & Items()
Definition: sch_screen.h:159
Schematic symbol object.
Definition: sch_component.h:79
wxPoint GetPosition() const override
void RemoveField(const wxString &aFieldName)
Removes a user field from the symbol.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
void onMatchTextKillFocus(wxFocusEvent &event) override
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
int Parse(const UTF8 &aId, LIB_ID_TYPE aType, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
void onOkButtonClicked(wxCommandEvent &aEvent) override
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.
const LIB_ID & GetLibId() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
virtual 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 const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
bool g_resetFieldVisibilities
void GetFields(LIB_FIELDS &aList)
Return a list of fields within this part.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
SCH_SHEET_PATH & CurrentSheet() const
Definition: schematic.h:121