KiCad PCB EDA Suite
selpart.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <confirm.h>
#include <pgm_base.h>
#include <sch_base_frame.h>
#include <symbol_lib_table.h>
#include <general.h>
#include <class_library.h>
#include <dialog_helpers.h>

Go to the source code of this file.

Functions

static void DisplayCmpDocAndKeywords (wxString &aSelection, void *aData)
 

Function Documentation

static void DisplayCmpDocAndKeywords ( wxString &  aSelection,
void *  aData 
)
static

Definition at line 41 of file selpart.cpp.

References LIB_ALIAS::GetDescription(), LIB_ALIAS::GetKeyWords(), SYMBOL_LIB_TABLE::LoadSymbol(), and numEval::Parse().

Referenced by SCH_BASE_FRAME::DisplayListComponentsInLib().

42 {
43  SYMBOL_LIB_TABLE* libs = (SYMBOL_LIB_TABLE*) aData;
44 
45  wxASSERT( libs );
46 
47  LIB_ID id;
48 
49  if( id.Parse( aSelection ) != -1 )
50  {
51  aSelection = _( "Invalid symbol library indentifier!" );
52  return;
53  }
54 
55  LIB_ALIAS* part = nullptr;
56 
57  try
58  {
59  part = libs->LoadSymbol( id );
60  }
61  catch( const IO_ERROR& ioe )
62  {
63  aSelection.Printf( _( "Error occurred loading symbol '%s' from library '%s'." ),
64  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
65  return;
66  }
67 
68  if( !part )
69  return;
70 
71  aSelection = _( "Description: " ) + part->GetDescription() + "\n";
72  aSelection += _( "Key Words: " ) + part->GetKeyWords();
73 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
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
wxString GetDescription() const
wxString GetKeyWords() const
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47