KiCad PCB EDA Suite
pcbnew/cross-probing.cpp File Reference

Cross probing functions to handle communication to andfrom Eeschema. More...

#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <kiway_express.h>
#include <wxPcbStruct.h>
#include <eda_dde.h>
#include <macros.h>
#include <pcbnew_id.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_zone.h>
#include <collectors.h>
#include <pcbnew.h>
#include <netlist_reader.h>
#include <pcb_netlist.h>
#include <dialogs/dialog_update_pcb.h>
#include <tools/pcb_actions.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <pcb_draw_panel_gal.h>
#include <pcb_painter.h>

Go to the source code of this file.

Functions

std::string FormatProbeItem (BOARD_ITEM *aItem)
 

Detailed Description

Cross probing functions to handle communication to andfrom Eeschema.

Definition in file pcbnew/cross-probing.cpp.

Function Documentation

std::string FormatProbeItem ( BOARD_ITEM aItem)

Definition at line 250 of file pcbnew/cross-probing.cpp.

References BOARD_ITEM::GetParent(), MODULE::GetReference(), EDA_TEXT::GetText(), TEXTE_MODULE::GetType(), PCB_MODULE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, StrPrintf(), TEXTE_MODULE::TEXT_is_REFERENCE, TEXTE_MODULE::TEXT_is_VALUE, TO_UTF8, and EDA_ITEM::Type().

Referenced by PCB_EDIT_FRAME::SendMessageToEESCHEMA().

251 {
252  MODULE* module;
253 
254  switch( aItem->Type() )
255  {
256  case PCB_MODULE_T:
257  module = (MODULE*) aItem;
258  return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
259 
260  case PCB_PAD_T:
261  {
262  module = (MODULE*) aItem->GetParent();
263  wxString pad = ((D_PAD*)aItem)->GetName();
264 
265  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
266  TO_UTF8( module->GetReference() ),
267  TO_UTF8( pad ) );
268  }
269 
270  case PCB_MODULE_TEXT_T:
271  {
272  module = static_cast<MODULE*>( aItem->GetParent() );
273 
274  TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
275 
276  const char* text_key;
277 
278  /* This can't be a switch since the break need to pull out
279  * from the outer switch! */
280  if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
281  text_key = "$REF:";
282  else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
283  text_key = "$VAL:";
284  else
285  break;
286 
287  return StrPrintf( "$PART: \"%s\" %s \"%s\"",
288  TO_UTF8( module->GetReference() ),
289  text_key,
290  TO_UTF8( text_mod->GetText() ) );
291  }
292 
293  default:
294  break;
295  }
296 
297  return "";
298 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
BOARD_ITEM_CONTAINER * GetParent() const
TEXT_TYPE GetType() const
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
int StrPrintf(std::string *result, const char *format,...)
Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a char...
Definition: richio.cpp:74
#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
class MODULE, a footprint
Definition: typeinfo.h:89
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:439