KiCad PCB EDA Suite
pcbnew/cross-probing.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 
34 #include <board.h>
35 #include <footprint.h>
36 #include <track.h>
37 #include <collectors.h>
38 #include <eda_dde.h>
39 #include <kiface_i.h>
40 #include <kiway_express.h>
43 #include <painter.h>
44 #include <pcb_edit_frame.h>
45 #include <pcbnew_settings.h>
46 #include <render_settings.h>
47 #include <tool/tool_manager.h>
48 #include <tools/pcb_actions.h>
49 #include <tools/selection_tool.h>
51 
52 /* Execute a remote command send by Eeschema via a socket,
53  * port KICAD_PCB_PORT_SERVICE_NUMBER
54  * cmdline = received command from Eeschema
55  * Commands are
56  * $PART: "reference" put cursor on component
57  * $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
58  * $NET: "net name" highlight the given net (if highlight tool is active)
59  * $CLEAR Clear existing highlight
60  * They are a keyword followed by a quoted string.
61  */
62 void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
63 {
64  char line[1024];
65  wxString msg;
66  wxString modName;
67  char* idcmd;
68  char* text;
69  int netcode = -1;
70  bool multiHighlight = false;
71  FOOTPRINT* footprint = nullptr;
72  PAD* pad = nullptr;
73  BOARD* pcb = GetBoard();
74 
75  CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
76 
78  KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
79 
80  strncpy( line, cmdline, sizeof(line) - 1 );
81  line[sizeof(line) - 1] = 0;
82 
83  idcmd = strtok( line, " \n\r" );
84  text = strtok( NULL, "\"\n\r" );
85 
86  if( idcmd == NULL )
87  return;
88 
89  if( strcmp( idcmd, "$NET:" ) == 0 )
90  {
91  if( !crossProbingSettings.auto_highlight )
92  return;
93 
94  wxString net_name = FROM_UTF8( text );
95 
96  NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
97 
98  if( netinfo )
99  {
100  netcode = netinfo->GetNet();
101 
102  MSG_PANEL_ITEMS items;
103  netinfo->GetMsgPanelInfo( this, items );
104  SetMsgPanel( items );
105  }
106  }
107  if( strcmp( idcmd, "$NETS:" ) == 0 )
108  {
109  if( !crossProbingSettings.auto_highlight )
110  return;
111 
112  wxStringTokenizer netsTok = wxStringTokenizer( FROM_UTF8( text ), "," );
113  bool first = true;
114 
115  while( netsTok.HasMoreTokens() )
116  {
117  NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
118 
119  if( netinfo )
120  {
121  if( first )
122  {
123  // TODO: Once buses are included in netlist, show bus name
124  MSG_PANEL_ITEMS items;
125  netinfo->GetMsgPanelInfo( this, items );
126  SetMsgPanel( items );
127  first = false;
128 
129  pcb->SetHighLightNet( netinfo->GetNet() );
130  renderSettings->SetHighlight( true, netinfo->GetNet() );
131  multiHighlight = true;
132  }
133  else
134  {
135  pcb->SetHighLightNet( netinfo->GetNet(), true );
136  renderSettings->SetHighlight( true, netinfo->GetNet(), true );
137  }
138  }
139  }
140 
141  netcode = -1;
142  }
143  else if( strcmp( idcmd, "$PIN:" ) == 0 )
144  {
145  wxString pinName = FROM_UTF8( text );
146 
147  text = strtok( NULL, " \n\r" );
148 
149  if( text && strcmp( text, "$PART:" ) == 0 )
150  text = strtok( NULL, "\"\n\r" );
151 
152  modName = FROM_UTF8( text );
153 
154  footprint = pcb->FindFootprintByReference( modName );
155 
156  if( footprint )
157  pad = footprint->FindPadByName( pinName );
158 
159  if( pad )
160  netcode = pad->GetNetCode();
161 
162  if( footprint == NULL )
163  msg.Printf( _( "%s not found" ), modName );
164  else if( pad == NULL )
165  msg.Printf( _( "%s pin %s not found" ), modName, pinName );
166  else
167  msg.Printf( _( "%s pin %s found" ), modName, pinName );
168 
169  SetStatusText( msg );
170  }
171  else if( strcmp( idcmd, "$PART:" ) == 0 )
172  {
173  pcb->ResetNetHighLight();
174 
175  modName = FROM_UTF8( text );
176 
177  footprint = pcb->FindFootprintByReference( modName );
178 
179  if( footprint )
180  msg.Printf( _( "%s found" ), modName );
181  else
182  msg.Printf( _( "%s not found" ), modName );
183 
184  SetStatusText( msg );
185  }
186  else if( strcmp( idcmd, "$SHEET:" ) == 0 )
187  {
188  msg.Printf( _( "Selecting all from sheet \"%s\"" ), FROM_UTF8( text ) );
189  wxString sheetUIID( FROM_UTF8( text ) );
190  SetStatusText( msg );
192  static_cast<void*>( &sheetUIID ) );
193  return;
194  }
195  else if( strcmp( idcmd, "$CLEAR" ) == 0 )
196  {
197  if( renderSettings->IsHighlightEnabled() )
198  {
199  renderSettings->SetHighlight( false );
200  view->UpdateAllLayersColor();
201  }
202 
203  if( pcb->IsHighLightNetON() )
204  {
205  pcb->ResetNetHighLight();
206  SetMsgPanel( pcb );
207  }
208 
209  GetCanvas()->Refresh();
210  return;
211  }
212 
213  BOX2I bbox = { { 0, 0 }, { 0, 0 } };
214 
215  if( footprint )
216  {
217  bbox = footprint->GetBoundingBox( false ); // No invisible text in bbox calc
218 
219  if( pad )
220  m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) pad );
221  else
222  m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) footprint );
223  }
224  else if( netcode > 0 || multiHighlight )
225  {
226  if( !multiHighlight )
227  {
228  renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
229  pcb->SetHighLightNet( netcode );
230  }
231  else
232  {
233  // Just pick the first one for area calculation
234  netcode = *pcb->GetHighLightNetCodes().begin();
235  }
236 
237  pcb->HighLightON();
238 
239  auto merge_area =
240  [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
241  {
242  if( aItem->GetNetCode() == netcode )
243  {
244  if( bbox.GetWidth() == 0 )
245  bbox = aItem->GetBoundingBox();
246  else
247  bbox.Merge( aItem->GetBoundingBox() );
248  }
249  };
250 
251  if( crossProbingSettings.center_on_items )
252  {
253  for( ZONE* zone : pcb->Zones() )
254  merge_area( zone );
255 
256  for( TRACK* track : pcb->Tracks() )
257  merge_area( track );
258 
259  for( FOOTPRINT* fp : pcb->Footprints() )
260  {
261  for( PAD* p : fp->Pads() )
262  merge_area( p );
263  }
264  }
265  }
266  else
267  {
268  renderSettings->SetHighlight( false );
269  }
270 
271  if( crossProbingSettings.center_on_items && bbox.GetWidth() > 0 && bbox.GetHeight() > 0 )
272  {
273 
274 //#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm
275 #ifdef DEFAULT_PCBNEW_CODE
276  auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
277  auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
278 
279  // The "fabs" on x ensures the right answer when the view is flipped
280  screenSize.x = std::max( 10.0, fabs( screenSize.x ) );
281  screenSize.y = std::max( 10.0, screenSize.y );
282  double ratio = std::max( fabs( bbSize.x / screenSize.x ), fabs( bbSize.y / screenSize.y ) );
283 
284  // Try not to zoom on every cross-probe; it gets very noisy
285  if( crossProbingSettings.zoom_to_fit && ( ratio < 0.5 || ratio > 1.0 ) )
286  view->SetScale( view->GetScale() / ratio );
287 #endif // DEFAULT_PCBNEW_CODE
288 
289 #ifndef DEFAULT_PCBNEW_CODE // Do the scaled zoom
290  auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
291  auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
292 
293  // This code tries to come up with a zoom factor that doesn't simply zoom in
294  // to the cross probed component, but instead shows a reasonable amount of the
295  // circuit around it to provide context. This reduces or eliminates the need
296  // to manually change the zoom because it's too close.
297 
298  // Using the default text height as a constant to compare against, use the
299  // height of the bounding box of visible items for a footprint to figure out
300  // if this is a big footprint (like a processor) or a small footprint (like a resistor).
301  // This ratio is not useful by itself as a scaling factor. It must be "bent" to
302  // provide good scaling at varying component sizes. Bigger components need less
303  // scaling than small ones.
304  double currTextHeight = Millimeter2iu( DEFAULT_TEXT_SIZE );
305 
306  double compRatio = bbSize.y / currTextHeight; // Ratio of component to text height
307  double compRatioBent = 1.0; // This will end up as the scaling factor we apply to "ratio"
308 
309  // This is similar to the original KiCad code that scaled the zoom to make sure components
310  // were visible on screen. It's simply a ratio of screen size to component size, and its
311  // job is to zoom in to make the component fullscreen. Earlier in the code the
312  // component BBox is given a 20% margin to add some breathing room. We compare
313  // the height of this enlarged component bbox to the default text height. If a component
314  // will end up with the sides clipped, we adjust later to make sure it fits on screen.
315  //
316  // The "fabs" on x ensures the right answer when the view is flipped
317  screenSize.x = std::max( 10.0, fabs( screenSize.x ) );
318  screenSize.y = std::max( 10.0, screenSize.y );
319  double ratio = std::max( -1.0, fabs( bbSize.y / screenSize.y ) );
320  // Original KiCad code for how much to scale the zoom
321  double kicadRatio = std::max( fabs( bbSize.x / screenSize.x ),
322  fabs( bbSize.y / screenSize.y ) );
323 
324  // LUT to scale zoom ratio to provide reasonable schematic context. Must work
325  // with footprints of varying sizes (e.g. 0402 package and 200 pin BGA).
326  // "first" is used as the input and "second" as the output
327  //
328  // "first" = compRatio (footprint height / default text height)
329  // "second" = Amount to scale ratio by
330  std::vector<std::pair<double, double>> lut{
331  { 1, 8 },
332  { 1.5, 5 },
333  { 3, 3 },
334  { 4.5, 2.5 },
335  { 8, 2.0 },
336  { 12, 1.7 },
337  { 16, 1.5 },
338  { 24, 1.3 },
339  { 32, 1.0 },
340  };
341 
342 
343  std::vector<std::pair<double, double>>::iterator it;
344 
345  compRatioBent = lut.back().second; // Large component default
346 
347  if( compRatio >= lut.front().first )
348  {
349  // Use LUT to do linear interpolation of "compRatio" within "first", then
350  // use that result to linearly interpolate "second" which gives the scaling
351  // factor needed.
352 
353  for( it = lut.begin(); it < lut.end() - 1; it++ )
354  {
355  if( it->first <= compRatio && next( it )->first >= compRatio )
356  {
357  double diffx = compRatio - it->first;
358  double diffn = next( it )->first - it->first;
359 
360  compRatioBent =
361  it->second + ( next( it )->second - it->second ) * diffx / diffn;
362  break; // We have our interpolated value
363  }
364  }
365  }
366  else
367  compRatioBent = lut.front().second; // Small component default
368 
369  // If the width of the part we're probing is bigger than what the screen width will be
370  // after the zoom, then punt and use the KiCad zoom algorithm since it guarantees the
371  // part's width will be encompassed within the screen. This will apply to parts that are
372  // much wider than they are tall.
373 
374  if( bbSize.x > screenSize.x * ratio * compRatioBent )
375  {
376  ratio = kicadRatio; // Use standard KiCad zoom algorithm for parts too wide to fit screen
377  compRatioBent = 1.0; // Reset so we don't modify the "KiCad" ratio
378  wxLogTrace( "CROSS_PROBE_SCALE",
379  "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f", ratio );
380  }
381 
382  // Now that "compRatioBent" holds our final scaling factor we apply it to the original
383  // fullscreen zoom ratio to arrive at the final ratio itself.
384  ratio *= compRatioBent;
385 
386  bool alwaysZoom = false; // DEBUG - allows us to minimize zooming or not
387  // Try not to zoom on every cross-probe; it gets very noisy
388  if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
389  view->SetScale( view->GetScale() / ratio );
390 #endif // ifndef DEFAULT_PCBNEW_CODE
391 
392  view->SetCenter( bbox.Centre() );
393  }
394 
395  view->UpdateAllLayersColor();
396  // Ensure the display is refreshed, because in some installs the refresh is done only
397  // when the gal canvas has the focus, and that is not the case when crossprobing from
398  // Eeschema:
399  GetCanvas()->Refresh();
400 }
401 
402 
403 std::string FormatProbeItem( BOARD_ITEM* aItem )
404 {
405  FOOTPRINT* footprint;
406 
407  if( !aItem )
408  return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
409 
410  switch( aItem->Type() )
411  {
412  case PCB_FOOTPRINT_T:
413  footprint = (FOOTPRINT*) aItem;
414  return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
415 
416  case PCB_PAD_T:
417  {
418  footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
419  wxString pad = static_cast<PAD*>( aItem )->GetName();
420 
421  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
422  TO_UTF8( footprint->GetReference() ),
423  TO_UTF8( pad ) );
424  }
425 
426  case PCB_FP_TEXT_T:
427  {
428  footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
429 
430  FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
431  const char* text_key;
432 
433  /* This can't be a switch since the break need to pull out
434  * from the outer switch! */
435  if( text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
436  text_key = "$REF:";
437  else if( text->GetType() == FP_TEXT::TEXT_is_VALUE )
438  text_key = "$VAL:";
439  else
440  break;
441 
442  return StrPrintf( "$PART: \"%s\" %s \"%s\"",
443  TO_UTF8( footprint->GetReference() ),
444  text_key,
445  TO_UTF8( text->GetText() ) );
446  }
447 
448  default:
449  break;
450  }
451 
452  return "";
453 }
454 
455 
456 /* Send a remote command to Eeschema via a socket,
457  * aSyncItem = item to be located on schematic (footprint, pin or text)
458  * Commands are
459  * $PART: "reference" put cursor on component anchor
460  * $PART: "reference" $PAD: "pad number" put cursor on the component pin
461  * $PART: "reference" $REF: "reference" put cursor on the component ref
462  * $PART: "reference" $VAL: "value" put cursor on the component value
463  */
465 {
466  std::string packet = FormatProbeItem( aSyncItem );
467 
468  if( !packet.empty() )
469  {
470  if( Kiface().IsSingle() )
471  SendCommand( MSG_TO_SCH, packet.c_str() );
472  else
473  {
474  // Typically ExpressMail is going to be s-expression packets, but since
475  // we have existing interpreter of the cross probe packet on the other
476  // side in place, we use that here.
477  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
478  }
479  }
480 }
481 
482 
483 void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
484 {
485  std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
486 
487  if( !packet.empty() )
488  {
489  if( Kiface().IsSingle() )
490  SendCommand( MSG_TO_SCH, packet.c_str() );
491  else
492  {
493  // Typically ExpressMail is going to be s-expression packets, but since
494  // we have existing interpreter of the cross probe packet on the other
495  // side in place, we use that here.
496  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
497  }
498  }
499 }
500 
501 
503 {
504  std::string& payload = mail.GetPayload();
505 
506  switch( mail.Command() )
507  {
509  {
510  NETLIST netlist;
511  STRING_FORMATTER sf;
512 
513  for( FOOTPRINT* footprint : this->GetBoard()->Footprints() )
514  {
515  COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
516  footprint->GetValue(), footprint->GetPath() );
517 
518  for( PAD* pad : footprint->Pads() )
519  {
520  const wxString& netname = pad->GetShortNetname();
521 
522  if( !netname.IsEmpty() )
523  component->AddNet( pad->GetName(), netname, wxEmptyString );
524  }
525 
526  netlist.AddComponent( component );
527  }
528 
529  netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
530  payload = sf.GetString();
531  }
532  break;
533 
535  try
536  {
537  NETLIST netlist;
539 
540  BOARD_NETLIST_UPDATER updater( this, GetBoard() );
541  updater.SetLookupByTimestamp( false );
542  updater.SetDeleteUnusedComponents ( false );
543  updater.SetReplaceFootprints( false );
544  updater.SetDeleteSinglePadNets( false );
545  updater.SetWarnPadNoNetInNetlist( false );
546  updater.UpdateNetlist( netlist );
547 
548  bool dummy;
549  OnNetlistChanged( updater, &dummy );
550  }
551  catch( const IO_ERROR& )
552  {
553  assert( false ); // should never happen
554  return;
555  }
556  break;
557 
558  case MAIL_CROSS_PROBE:
559  ExecuteRemoteCommand( payload.c_str() );
560  break;
561 
562  case MAIL_PCB_UPDATE:
564  break;
565 
566  case MAIL_IMPORT_FILE:
567  {
568  // Extract file format type and path (plugin type and path separated with \n)
569  size_t split = payload.find( '\n' );
570  wxCHECK( split != std::string::npos, /*void*/ );
571  int importFormat;
572 
573  try
574  {
575  importFormat = std::stoi( payload.substr( 0, split ) );
576  }
577  catch( std::invalid_argument& )
578  {
579  wxFAIL;
580  importFormat = -1;
581  }
582 
583  std::string path = payload.substr( split + 1 );
584  wxASSERT( !path.empty() );
585 
586  if( importFormat >= 0 )
587  importFile( path, importFormat );
588  }
589  break;
590 
591  // many many others.
592  default:
593  ;
594  }
595 }
596 
CITER next(CITER it)
Definition: ptree.cpp:126
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1234
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:290
KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
int GetNetCode() const
Function GetNetCode.
DDE server & client.
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to eeschema for highlighting.
class FP_TEXT, text in a footprint
Definition: typeinfo.h:93
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:109
ZONES & Zones()
Definition: board.h:289
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:1981
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: board_item.h:86
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:456
BOARD_NETLIST_UPDATER updates the BOARD with a new netlist.
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:446
void SetDeleteSinglePadNets(bool aEnabled)
Enables "delete single pad nets" option
bool IsHighLightNetON() const
Definition: board.h:437
#define MSG_TO_SCH
Definition: eda_dde.h:46
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:141
void SetWarnPadNoNetInNetlist(bool aEnabled)
Enables warning option if a connectable pad is not found in netlist connectable = pad with a name and...
BOARD_NETLIST_UPDATER class definition.
class PAD, a pad in a footprint
Definition: typeinfo.h:90
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:161
bool SendCommand(int service, const char *cmdline)
Definition: eda_dde.cpp:131
void SetLookupByTimestamp(bool aEnabled)
Enables component lookup by timestamp instead of reference
PCBNEW_SETTINGS * GetPcbNewSettings()
bool IsHighlightEnabled() const
Function IsHighlightEnabled Returns current highlight setting.
void OnNetlistChanged(BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
Called after netlist is updated.
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
bool UpdateNetlist(NETLIST &aNetlist)
Function UpdateNetlist()
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:201
void AddComponent(COMPONENT *aComponent)
Function AddComponent adds aComponent to the NETLIST.
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:78
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:95
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
Cross-probing behavior.
Definition: app_settings.h:30
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:1959
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:585
NETLIST stores all of information read from a netlist along with the flags used to update the NETLIST...
Definition: pcb_netlist.h:194
#define NULL
bool IsSingle() const
Function IsSingle is this KIFACE_I running under single_top?
Definition: kiface_i.h:117
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently...
coord_type GetWidth() const
Definition: box2.h:197
#define CTL_OMIT_FILTERS
Definition: pcb_netlist.h:283
FOOTPRINTS & Footprints()
Definition: board.h:283
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void SetReplaceFootprints(bool aEnabled)
Enables replacing footprints with new ones
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
const std::string & GetString()
Definition: richio.h:476
PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a PAD* with a matching name.
Definition: footprint.cpp:846
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:433
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:1968
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:386
std::string FormatProbeItem(BOARD_ITEM *aItem)
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:80
class FOOTPRINT, a footprint
Definition: typeinfo.h:89
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:422
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:559
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:439
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:302
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
Vec Centre() const
Definition: box2.h:79
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
static TOOL_ACTION selectOnSheetFromEeschema
Selects all components on sheet from Eeschema crossprobing.
Definition: pcb_actions.h:86
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:186
#define _(s)
Definition: 3d_actions.cpp:33
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: footprint.cpp:628
void Format(const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
void SetDeleteUnusedComponents(bool aEnabled)
Enables removing unused components
coord_type GetHeight() const
Definition: box2.h:198
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:76
BOARD * GetBoard() const
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:159
VIEW.
Definition: view.h:63
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo returns the information about the NETINFO_ITEM in aList to display in the me...
Definition: pad.h:59
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:776
double GetScale() const
Function GetScale()
Definition: view.h:259
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:179
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction)
Definition: pcb_netlist.h:128
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:446
static constexpr int Millimeter2iu(double mm)
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
std::string & GetPayload()
Function Payload returns the payload, which can be any text but it typicall self identifying s-expres...
Definition: kiway_express.h:62
bool FetchNetlistFromSchematic(NETLIST &aNetlist, FETCH_NETLIST_MODE aMode)
TRACKS & Tracks()
Definition: board.h:280
Definition: track.h:83
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Splits the input string into a vector of output strings.
Definition: kicad_string.h:268
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:1255
KICAD_T Type() const
Function Type()
Definition: eda_item.h:181