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

◆ FormatProbeItem()

std::string FormatProbeItem ( BOARD_ITEM aItem)

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

278 {
279  MODULE* module;
280 
281  if( !aItem )
282  return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
283 
284  switch( aItem->Type() )
285  {
286  case PCB_MODULE_T:
287  module = (MODULE*) aItem;
288  return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
289 
290  case PCB_PAD_T:
291  {
292  module = (MODULE*) aItem->GetParent();
293  wxString pad = ((D_PAD*)aItem)->GetName();
294 
295  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
296  TO_UTF8( module->GetReference() ),
297  TO_UTF8( pad ) );
298  }
299 
300  case PCB_MODULE_TEXT_T:
301  {
302  module = static_cast<MODULE*>( aItem->GetParent() );
303 
304  TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
305 
306  const char* text_key;
307 
308  /* This can't be a switch since the break need to pull out
309  * from the outer switch! */
310  if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
311  text_key = "$REF:";
312  else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
313  text_key = "$VAL:";
314  else
315  break;
316 
317  return StrPrintf( "$PART: \"%s\" %s \"%s\"",
318  TO_UTF8( module->GetReference() ),
319  text_key,
320  TO_UTF8( text_mod->GetText() ) );
321  }
322 
323  default:
324  break;
325  }
326 
327  return "";
328 }
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
#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 & GetReference() const
Function GetReference.
Definition: class_module.h:462
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:201

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().