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 <pcb_edit_frame.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 <board_netlist_updater.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 251 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, numEval::StrPrintf(), TEXTE_MODULE::TEXT_is_REFERENCE, TEXTE_MODULE::TEXT_is_VALUE, TO_UTF8, and EDA_ITEM::Type().

Referenced by PCB_EDIT_FRAME::SendMessageToEESCHEMA().

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