KiCad PCB EDA Suite
eeschema/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 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <fctsys.h>
27 #include <pgm_base.h>
28 #include <kiface_i.h>
29 #include <kiway_express.h>
30 #include <macros.h>
31 #include <eda_dde.h>
32 #include <connection_graph.h>
33 #include <sch_edit_frame.h>
34 #include <eeschema_settings.h>
35 #include <general.h>
36 #include <lib_item.h>
37 #include <lib_pin.h>
38 #include <sch_component.h>
39 #include <sch_sheet.h>
40 #include <sch_view.h>
41 #include <schematic.h>
42 #include <reporter.h>
44 #include <project/project_file.h>
45 #include <project/net_settings.h>
46 #include <tools/ee_actions.h>
48 #include <advanced_config.h>
49 #include <netclass.h>
50 
52  bool aSearchHierarchy,
53  SCH_SEARCH_T aSearchType,
54  const wxString& aSearchText )
55 {
56  SCH_SHEET_PATH* sheetWithComponentFound = NULL;
57  SCH_COMPONENT* component = NULL;
58  wxPoint pos;
59  LIB_PIN* pin = nullptr;
60  SCH_SHEET_LIST sheetList;
61  SCH_ITEM* foundItem = nullptr;
62 
63  if( !aSearchHierarchy )
64  sheetList.push_back( m_frame->GetCurrentSheet() );
65  else
66  sheetList.BuildSheetList( &m_frame->Schematic().Root() );
67 
68  for( SCH_SHEET_PATH& sheet : sheetList )
69  {
70  SCH_SCREEN* screen = sheet.LastScreen();
71 
72  for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
73  {
74  SCH_COMPONENT* pSch = static_cast<SCH_COMPONENT*>( item );
75 
76  if( aReference.CmpNoCase( pSch->GetRef( &sheet ) ) == 0 )
77  {
78  component = pSch;
79  sheetWithComponentFound = &sheet;
80 
81  if( aSearchType == HIGHLIGHT_PIN )
82  {
83  pos = pSch->GetPosition(); // temporary: will be changed if the pin is found.
84  pin = pSch->GetPin( aSearchText );
85 
86  if( pin )
87  {
88  pos += pin->GetPosition();
89  foundItem = component;
90  break;
91  }
92  }
93  else
94  {
95  pos = pSch->GetPosition();
96  foundItem = component;
97  break;
98  }
99  }
100  }
101 
102  if( foundItem )
103  break;
104  }
105 
106  CROSS_PROBING_SETTINGS& crossProbingSettings = m_frame->eeconfig()->m_CrossProbing;
107 
108  if( component )
109  {
110  if( *sheetWithComponentFound != m_frame->GetCurrentSheet() )
111  {
112  m_frame->Schematic().SetCurrentSheet( *sheetWithComponentFound );
114  }
115 
116  wxPoint delta;
117  pos -= component->GetPosition();
118  delta = component->GetTransform().TransformCoordinate( pos );
119  pos = delta + component->GetPosition();
120 
121  if( crossProbingSettings.center_on_items )
122  {
124  m_frame->CenterScreen( pos, false );
125 
126  if( crossProbingSettings.zoom_to_fit )
127  {
128  EDA_RECT bbox = component->GetBoundingBox();
129 
130  wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
131  VECTOR2D screenSize = getView()->GetViewport().GetSize();
132 
133  screenSize.x = std::max( 10.0, screenSize.x );
134  screenSize.y = std::max( 10.0, screenSize.y );
135  double ratio = std::max( fabs( bbSize.x / screenSize.x ),
136  fabs( bbSize.y / screenSize.y ) );
137 
138  // Try not to zoom on every cross-probe; it gets very noisy
139  if( ratio < 0.1 || ratio > 1.0 )
140  getView()->SetScale( getView()->GetScale() / ratio );
141  }
142  }
143  }
144 
145  /* Print diag */
146  wxString msg_item;
147  wxString msg;
148 
149  if( aSearchType == HIGHLIGHT_PIN )
150  msg_item.Printf( _( "pin %s" ), aSearchText );
151  else
152  msg_item = _( "component" );
153 
154  if( component )
155  {
156  if( foundItem )
157  msg.Printf( _( "%s %s found" ), aReference, msg_item );
158  else
159  msg.Printf( _( "%s found but %s not found" ), aReference, msg_item );
160  }
161  else
162  msg.Printf( _( "Component %s not found" ), aReference );
163 
164  m_frame->SetStatusText( msg );
165 
166  m_probingPcbToSch = true; // recursion guard
167  {
168  // Clear any existing highlighting
170 
171  if( foundItem )
172  m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, foundItem );
173  }
174  m_probingPcbToSch = false;
175 
176  m_frame->GetCanvas()->Refresh();
177 
178  return foundItem;
179 }
180 
181 
182 void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
183 {
185  char line[1024];
186 
187  strncpy( line, cmdline, sizeof(line) - 1 );
188  line[ sizeof(line) - 1 ] = '\0';
189 
190  char* idcmd = strtok( line, " \n\r" );
191  char* text = strtok( NULL, "\"\n\r" );
192 
193  if( idcmd == NULL )
194  return;
195 
196  CROSS_PROBING_SETTINGS& crossProbingSettings = eeconfig()->m_CrossProbing;
197 
198  if( strcmp( idcmd, "$NET:" ) == 0 )
199  {
200  if( !crossProbingSettings.auto_highlight )
201  return;
202 
203  wxString netName = FROM_UTF8( text );
204 
205  if( auto sg = Schematic().ConnectionGraph()->FindFirstSubgraphByName( netName ) )
206  m_highlightedConn = sg->m_driver_connection;
207 
209 
210  SetStatusText( _( "Selected net: " ) + UnescapeString( netName ) );
211  return;
212  }
213 
214  if( strcmp( idcmd, "$CLEAR:" ) == 0 )
215  {
216  // Cross-probing is now done through selection so we no longer need a clear command
217  return;
218  }
219 
220  if( text == NULL )
221  return;
222 
223  if( strcmp( idcmd, "$PART:" ) != 0 )
224  return;
225 
226  wxString part_ref = FROM_UTF8( text );
227 
228  /* look for a complement */
229  idcmd = strtok( NULL, " \n\r" );
230 
231  if( idcmd == NULL ) // Highlight component only (from Cvpcb or Pcbnew)
232  {
233  // Highlight component part_ref, or clear Highlight, if part_ref is not existing
234  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
235  return;
236  }
237 
238  text = strtok( NULL, "\"\n\r" );
239 
240  if( text == NULL )
241  return;
242 
243  wxString msg = FROM_UTF8( text );
244 
245  if( strcmp( idcmd, "$REF:" ) == 0 )
246  {
247  // Highlighting the reference itself isn't actually that useful, and it's harder to
248  // see. Highlight the parent and display the message.
249  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
250  }
251  else if( strcmp( idcmd, "$VAL:" ) == 0 )
252  {
253  // Highlighting the value itself isn't actually that useful, and it's harder to see.
254  // Highlight the parent and display the message.
255  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
256  }
257  else if( strcmp( idcmd, "$PAD:" ) == 0 )
258  {
259  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_PIN, msg );
260  }
261  else
262  {
263  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
264  }
265 }
266 
267 
268 std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aComp )
269 {
270  // This is a keyword followed by a quoted string.
271 
272  // Cross probing to Pcbnew if a pin or a component is found
273  switch( aItem->Type() )
274  {
275  case SCH_FIELD_T:
276  if( aComp )
277  return StrPrintf( "$PART: \"%s\"", TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
278  break;
279 
280  case SCH_COMPONENT_T:
281  aComp = (SCH_COMPONENT*) aItem;
282  return StrPrintf( "$PART: \"%s\"", TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
283 
284  case SCH_SHEET_T:
285  {
286  // For cross probing, we need the full path of the sheet, because
287  // in complex hierarchies the sheet uuid of not unique
288  SCH_SHEET* sheet = (SCH_SHEET*)aItem;
289  wxString full_path;
290 
291  SCH_SHEET* parent = sheet;
292  while( (parent = dynamic_cast<SCH_SHEET*>( parent->GetParent() ) ) )
293  {
294  if( parent->GetParent() ) // The root sheet has no parent and path is just "/"
295  {
296  full_path.Prepend( parent->m_Uuid.AsString() );
297  full_path.Prepend( "/" );
298  }
299  }
300 
301  full_path += "/" + sheet->m_Uuid.AsString();
302 
303  return StrPrintf( "$SHEET: \"%s\"", TO_UTF8( full_path ) );
304  }
305 
306  case SCH_PIN_T:
307  {
308  SCH_PIN* pin = (SCH_PIN*) aItem;
309  aComp = pin->GetParentComponent();
310 
311  if( !pin->GetNumber().IsEmpty() )
312  {
313  return StrPrintf( "$PIN: \"%s\" $PART: \"%s\"",
314  TO_UTF8( pin->GetNumber() ),
315  TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
316  }
317  else
318  {
319  return StrPrintf( "$PART: \"%s\"",
320  TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
321  }
322  }
323 
324  default:
325  break;
326  }
327 
328  return "";
329 }
330 
331 
333 {
334  wxASSERT( aObjectToSync ); // fix the caller
335 
336  if( !aObjectToSync )
337  return;
338 
339  std::string packet = FormatProbeItem( aObjectToSync, aLibItem );
340 
341  if( !packet.empty() )
342  {
343  if( Kiface().IsSingle() )
344  SendCommand( MSG_TO_PCB, packet.c_str() );
345  else
346  {
347  // Typically ExpressMail is going to be s-expression packets, but since
348  // we have existing interpreter of the cross probe packet on the other
349  // side in place, we use that here.
351  }
352  }
353 }
354 
355 
356 void SCH_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
357 {
358  // The command is a keyword followed by a quoted string.
359 
360  std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
361 
362  if( !packet.empty() )
363  {
364  if( Kiface().IsSingle() )
365  SendCommand( MSG_TO_PCB, packet.c_str() );
366  else
367  {
368  // Typically ExpressMail is going to be s-expression packets, but since
369  // we have existing interpreter of the cross probe packet on the other
370  // side in place, we use that here.
372  }
373  }
374 }
375 
376 
378 {
379  if( !aConnection )
380  {
382  return;
383  }
384 
385  if( aConnection->IsNet() )
386  {
387  SendCrossProbeNetName( aConnection->Name() );
388  return;
389  }
390 
391  if( aConnection->Members().empty() )
392  return;
393 
394  auto all_members = aConnection->AllMembers();
395 
396  wxString nets = all_members[0]->Name();
397 
398  if( all_members.size() == 1 )
399  {
400  SendCrossProbeNetName( nets );
401  return;
402  }
403 
404  // TODO: This could be replaced by just sending the bus name once we have bus contents
405  // included as part of the netlist sent from eeschema to pcbnew (and thus pcbnew can
406  // natively keep track of bus membership)
407 
408  for( size_t i = 1; i < all_members.size(); i++ )
409  nets << "," << all_members[i]->Name();
410 
411  std::string packet = StrPrintf( "$NETS: \"%s\"", TO_UTF8( nets ) );
412 
413  if( !packet.empty() )
414  {
415  if( Kiface().IsSingle() )
416  SendCommand( MSG_TO_PCB, packet.c_str() );
417  else
418  {
419  // Typically ExpressMail is going to be s-expression packets, but since
420  // we have existing interpreter of the cross probe packet on the other
421  // side in place, we use that here.
423  }
424  }
425 }
426 
427 
429 {
430  std::string packet = "$CLEAR\n";
431 
432  if( Kiface().IsSingle() )
433  SendCommand( MSG_TO_PCB, packet.c_str() );
434  else
435  {
436  // Typically ExpressMail is going to be s-expression packets, but since
437  // we have existing interpreter of the cross probe packet on the other
438  // side in place, we use that here.
440  }
441 }
442 
443 
445 {
446  std::string& payload = mail.GetPayload();
447 
448  switch( mail.Command() )
449  {
450  case MAIL_CROSS_PROBE:
451  ExecuteRemoteCommand( payload.c_str() );
452  break;
453 
455  {
456  if( payload.find( "quiet-annotate" ) != std::string::npos )
457  {
459  AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
461  }
462 
463  if( payload.find( "no-annotate" ) == std::string::npos )
464  {
465  // Ensure schematic is OK for netlist creation (especially that it is fully annotated):
466  if( !ReadyToNetlist() )
467  return;
468  }
469 
470  NETLIST_EXPORTER_KICAD exporter( &Schematic() );
471  STRING_FORMATTER formatter;
472 
473  // TODO remove once real-time connectivity is a given
474  if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
475  // Ensure the netlist data is up to date:
477 
478  exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
479 
480  payload = formatter.GetString();
481  }
482  break;
483 
485  try
486  {
488  controlTool->BackAnnotateFootprints( payload );
489  }
490  catch( const IO_ERROR& DBG( ioe ) )
491  {
492  DBG( printf( "%s: ioe:%s\n", __func__, TO_UTF8( ioe.What() ) );)
493  }
494  break;
495 
496  case MAIL_SCH_REFRESH:
497  {
498  SCH_SCREENS schematic( Schematic().Root() );
499  schematic.TestDanglingEnds();
500 
502  GetCanvas()->Refresh();
503  }
504  break;
505 
507  {
508  NET_SETTINGS& netSettings = Prj().GetProjectFile().NetSettings();
509 
510  netSettings.m_NetClassAssignments.clear();
511 
512  // Establish the set of nets which is currently valid
513  for( const wxString& name : Schematic().GetNetClassAssignmentCandidates() )
514  netSettings.m_NetClassAssignments[ name ] = "Default";
515 
516  // Copy their netclass assignments, dropping any assignments to non-current nets.
517  for( auto& ii : netSettings.m_NetClasses )
518  {
519  for( const wxString& member : *ii.second )
520  {
521  if( netSettings.m_NetClassAssignments.count( member ) )
522  netSettings.m_NetClassAssignments[ member ] = ii.first;
523  }
524 
525  ii.second->Clear();
526  }
527 
528  // Update the membership lists to contain only the current nets.
529  for( const std::pair<const wxString, wxString>& ii : netSettings.m_NetClassAssignments )
530  {
531  if( ii.second == "Default" )
532  continue;
533 
534  NETCLASSPTR netclass = netSettings.m_NetClasses.Find( ii.second );
535 
536  if( netclass )
537  netclass->Add( ii.first );
538  }
539 
540  netSettings.ResolveNetClassAssignments();
541  }
542  break;
543 
544  case MAIL_IMPORT_FILE:
545  {
546  // Extract file format type and path (plugin type and path separated with \n)
547  size_t split = payload.find( '\n' );
548  wxCHECK( split != std::string::npos, /*void*/ );
549  int importFormat;
550 
551  try
552  {
553  importFormat = std::stoi( payload.substr( 0, split ) );
554  }
555  catch( std::invalid_argument& )
556  {
557  wxFAIL;
558  importFormat = -1;
559  }
560 
561  std::string path = payload.substr( split + 1 );
562  wxASSERT( !path.empty() );
563 
564  if( importFormat >= 0 )
565  importFile( path, importFormat );
566  }
567  break;
568 
569  case MAIL_SCH_SAVE:
570  if( SaveProject() )
571  payload = "success";
572 
573  break;
574 
575  case MAIL_SCH_UPDATE:
577  break;
578 
579  default:
580  ;
581  }
582 }
SCH_SHEET_LIST.
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
std::map< wxString, wxString > m_NetClassAssignments
Definition: net_settings.h:43
KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:538
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
DDE server & client.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
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
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:114
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to pcbnew for highlighting.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void ResolveNetClassAssignments()
Explodes the list of netclass assignments to include atomic members of composite labels (buses).
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
void SendCrossProbeClearHighlight()
Tells PcbNew to clear the existing highlighted net, if one exists.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void AnnotateComponents(bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER &aReporter)
Annotate the components in the schematic that are not currently annotated.
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
int GetWidth() const
Definition: eda_rect.h:119
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
Annotate incrementally using the first free reference number.
wxString AsString() const
Definition: common.cpp:165
NET_SETTINGS & NetSettings()
Definition: project_file.h:92
LIB_PIN * GetPin(const wxString &number)
Find a symbol pin by number.
bool SendCommand(int service, const char *cmdline)
Definition: eda_dde.cpp:132
bool ReadyToNetlist(bool aSilent=false, bool aSilentAnnotate=false)
Checks if we are ready to write a netlist file for the current schematic.
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:229
std::string FormatProbeItem(EDA_ITEM *aItem, SCH_COMPONENT *aComp)
Item needs to be redrawn.
Definition: view_item.h:63
void Format(OUTPUTFORMATTER *aOutputFormatter, int aCtl)
Output this s-expression netlist into aOutputFormatter.
static TOOL_ACTION updateNetHighlighting
Definition: ee_actions.h:208
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
Field Reference of part, i.e. "IC21".
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
This file contains miscellaneous commonly used macros and functions.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
EESCHEMA_SETTINGS * eeconfig() const
const wxString & GetNumber() const
Definition: sch_pin.h:104
SCH_EDITOR_CONTROL.
void SendMessageToPCBNEW(EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
Send a message to Pcbnew via a socket connection.
Cross-probing behavior.
Definition: app_settings.h:30
SCH_ITEM * FindComponentAndItem(const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
Finds a component in the schematic and an item in this component.
void BackAnnotateFootprints(const std::string &aChangedSetOfReferences)
Definition: backanno.cpp:46
static TOOL_ACTION updateSchematicFromPcb
Definition: actions.h:158
NETCLASSES m_NetClasses
Definition: net_settings.h:39
const std::vector< std::shared_ptr< SCH_CONNECTION > > AllMembers() const
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
#define NULL
bool IsSingle() const
Function IsSingle is this KIFACE_I running under single_top?
Definition: kiface_i.h:117
VTBL_ENTRY PROJECT_FILE & GetProjectFile() const
Definition: project.h:129
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
TRANSFORM & GetTransform() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Annotate by position of component in the schematic sheet object list.
Generate the KiCad netlist format supported by Pcbnew.
SCHEMATIC & Schematic() const
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
NET_SETTINGS stores various net-related settings in a project context.
Definition: net_settings.h:31
const wxString & Name(bool aIgnoreSheet=false) const
const std::string & GetString()
Definition: richio.h:475
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
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
const SCH_CONNECTION * m_highlightedConn
The highlighted net or bus, or nullptr.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
const KIID m_Uuid
Definition: base_struct.h:162
wxPoint GetPosition() const override
Definition: lib_pin.h:430
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
static bool m_allowRealTime
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
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:428
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
bool IsNet() const
SCH_SHEET & Root() const
Definition: schematic.h:97
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
see class PGM_BASE
SCH_SEARCH_T
Schematic search type used by the socket link with Pcbnew.
void TestDanglingEnds()
const char * name
Definition: DXF_plotter.cpp:60
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
EE_RTREE & Items()
Definition: sch_screen.h:158
#define GNL_ALL
#define MSG_TO_PCB
Definition: eda_dde.h:45
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Schematic symbol object.
Definition: sch_component.h:88
wxPoint GetPosition() const override
void SetCrossProbeConnection(const SCH_CONNECTION *aConnection)
Sends a connection (net or bus) to pcbnew for highlighting.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
#define TO_UTF8(wxstring)
void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command sent by Pcbnew via a socket connection.
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
SCH_SHEET_PATH & GetCurrentSheet() const
virtual void CenterScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
void AnnotatePowerSymbols()
Function AnnotatePowerSymbols Silently annotates the not yet annotated power symbols of the entire hi...
#define DBG(x)
Definition: fctsys.h:33
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
const Vec & GetSize() const
Definition: box2.h:188
static REPORTER & GetInstance()
Definition: reporter.cpp:105
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:141
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition: schematic.h:127
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
SCH_COMPONENT * GetParentComponent() const
Definition: sch_pin.cpp:64
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
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
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
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:126
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193