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 <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

◆ FormatProbeItem()

std::string FormatProbeItem ( BOARD_ITEM aItem)

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

301 {
302  MODULE* module;
303 
304  if( !aItem )
305  return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
306 
307  switch( aItem->Type() )
308  {
309  case PCB_MODULE_T:
310  module = (MODULE*) aItem;
311  return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
312 
313  case PCB_PAD_T:
314  {
315  module = (MODULE*) aItem->GetParent();
316  wxString pad = ((D_PAD*)aItem)->GetName();
317 
318  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
319  TO_UTF8( module->GetReference() ),
320  TO_UTF8( pad ) );
321  }
322 
323  case PCB_MODULE_TEXT_T:
324  {
325  module = static_cast<MODULE*>( aItem->GetParent() );
326 
327  TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
328 
329  const char* text_key;
330 
331  /* This can't be a switch since the break need to pull out
332  * from the outer switch! */
333  if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
334  text_key = "$REF:";
335  else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
336  text_key = "$VAL:";
337  else
338  break;
339 
340  return StrPrintf( "$PART: \"%s\" %s \"%s\"",
341  TO_UTF8( module->GetReference() ),
342  text_key,
343  TO_UTF8( text_mod->GetText() ) );
344  }
345 
346  default:
347  break;
348  }
349 
350  return "";
351 }
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
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:462
#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
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References BOARD_ITEM::GetParent(), MODULE::GetReference(), 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().