KiCad PCB EDA Suite
sheet.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <sch_draw_panel.h>
26 #include <confirm.h>
27 #include <kiface_i.h>
28 #include <project.h>
30 #include <tool/tool_manager.h>
31 #include <sch_edit_frame.h>
33 #include <sch_sheet.h>
34 #include <sch_sheet_path.h>
35 #include <sch_view.h>
36 #include <sch_painter.h>
37 #include <schematic.h>
38 #include <symbol_lib_table.h>
40 #include <tool/actions.h>
41 
42 #include <wx/clipbrd.h>
43 #include <wx/dcmemory.h>
44 
45 
47 {
48  wxASSERT( aSheet && aHierarchy );
49 
50  wxString msg;
51  SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // The full schematic sheet hierarchy.
52  SCH_SHEET_LIST sheetHierarchy( aSheet ); // This is the hierarchy of the loaded file.
53 
54  wxFileName destFile = aHierarchy->LastScreen()->GetFileName();
55 
56  // SCH_SCREEN object file paths are expected to be absolute. If this assert fires,
57  // something is seriously broken.
58  wxASSERT( destFile.IsAbsolute() );
59 
60  if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath() ) )
61  {
62  msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
63  "has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
64  "the schematic hierarchy." ),
65  destFile.GetFullPath() );
66  DisplayError( this, msg );
67  return true;
68  }
69 
70  return false;
71 }
72 
73 
75 {
76  wxASSERT( aSheet && aSheet->GetScreen() );
77 
78  wxString msg;
79  SCH_SCREENS newScreens( aSheet );
80 
81  if( newScreens.HasNoFullyDefinedLibIds() )
82  {
83  msg.Printf( _( "The schematic \"%s\" has not had it's symbol library links remapped "
84  "to the symbol library table. The project this schematic belongs to "
85  "must first be remapped before it can be imported into the current "
86  "project." ), aSheet->GetScreen()->GetFileName() );
87  DisplayInfoMessage( this, msg );
88  return true;
89  }
90 
91  return false;
92 }
93 
94 
95 void SCH_EDIT_FRAME::InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename )
96 {
97  aSheet->SetScreen( new SCH_SCREEN( &Schematic() ) );
98  aSheet->GetScreen()->SetModify();
99  aSheet->GetScreen()->SetFileName( aNewFilename );
100 }
101 
102 
104  const wxString& aFileName )
105 {
106  wxASSERT( aSheet && aHierarchy );
107 
108  wxString msg;
109  wxString topLevelSheetPath;
110  wxFileName tmp;
111  wxFileName currentSheetFileName;
112  bool libTableChanged = false;
113  SCH_SCREEN* currentScreen = aHierarchy->LastScreen();
114  SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromSchPath( aFileName );
115  SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( schFileType ) );
116  std::unique_ptr< SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( &Schematic() );
117 
118  // This will cause the sheet UUID to be set to the loaded schematic UUID. This is required
119  // to ensure all of the sheet paths in any subsheets are correctly generated.
120  const_cast<KIID&>( newSheet->m_Uuid ) = KIID( 0 );
121 
122  wxFileName fileName( aFileName );
123 
124  if( !fileName.IsAbsolute() && !fileName.MakeAbsolute() )
125  {
126  wxFAIL_MSG( wxString::Format( "Cannot make file name \"%s\" path absolute.", aFileName ) );
127  return false;
128  }
129 
130  wxString fullFilename = fileName.GetFullPath();
131 
132  try
133  {
134  if( aSheet->GetScreen() != nullptr )
135  {
136  newSheet.reset( pi->Load( fullFilename, &Schematic() ) );
137  }
138  else
139  {
140  newSheet->SetFileName( fullFilename );
141  pi->Load( fullFilename, &Schematic(), newSheet.get() );
142  }
143 
144  if( !pi->GetError().IsEmpty() )
145  {
146  msg = _( "The entire schematic could not be loaded. Errors occurred attempting "
147  "to load hierarchical sheet schematics." );
148 
149  wxMessageDialog msgDlg1( this, msg, _( "Schematic Load Error" ),
150  wxOK | wxCANCEL | wxCANCEL_DEFAULT |
151  wxCENTER | wxICON_QUESTION );
152  msgDlg1.SetOKLabel( wxMessageDialog::ButtonLabel( _( "Use partial schematic" ) ) );
153  msgDlg1.SetExtendedMessage( pi->GetError() );
154 
155  if( msgDlg1.ShowModal() == wxID_CANCEL )
156  return false;
157  }
158  }
159  catch( const IO_ERROR& ioe )
160  {
161  msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), fullFilename );
162  DisplayErrorMessage( this, msg, ioe.What() );
163 
164  msg.Printf( _( "Failed to load schematic \"%s\"" ), fullFilename );
165  SetMsgPanel( wxEmptyString, msg );
166 
167  return false;
168  }
169 
170  tmp = fileName;
171 
172  // If the loaded schematic is in a different folder from the current project and
173  // it contains hierarchical sheets, the hierarchical sheet paths need to be updated.
174  if( fileName.GetPathWithSep() != Prj().GetProjectPath() && newSheet->CountSheets() )
175  {
176  // Give the user the option to choose relative path if possible.
177  if( tmp.MakeRelativeTo( Prj().GetProjectPath() ) )
178  topLevelSheetPath = tmp.GetPathWithSep();
179  else
180  topLevelSheetPath = fileName.GetPathWithSep();
181 
182  if( wxFileName::GetPathSeparator() == '\\' )
183  topLevelSheetPath.Replace( "\\", "/" );
184  }
185 
186  // Make sure any new sheet changes do not cause any recursion issues.
187  SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // This is the schematic sheet hierarchy.
188  SCH_SHEET_LIST sheetHierarchy( newSheet.get() ); // This is the hierarchy of the loaded file.
189 
190  if( CheckSheetForRecursion( newSheet.get(), aHierarchy )
191  || checkForNoFullyDefinedLibIds( newSheet.get() ) )
192  {
193  return false;
194  }
195 
196  // Make a valiant attempt to warn the user of all possible scenarios where there could
197  // be broken symbol library links.
198  wxArrayString names;
199  wxArrayString newLibNames;
200  SCH_SCREENS newScreens( newSheet.get() ); // All screens associated with the import.
201  SCH_SCREENS prjScreens( &Schematic().Root() );
202 
203  newScreens.GetLibNicknames( names );
204 
205  wxMessageDialog::ButtonLabel okButtonLabel( _( "Continue Load" ) );
206  wxMessageDialog::ButtonLabel cancelButtonLabel( _( "Cancel Load" ) );
207 
208  if( fileName.GetPathWithSep() == Prj().GetProjectPath()
209  && !prjScreens.HasSchematic( fullFilename ) )
210  {
211  // A schematic in the current project path that isn't part of the current project.
212  // It's possible the user copied this schematic from another project so the library
213  // links may not be avaible. Even this is check is no guarantee that all symbol
214  // library links are valid but it's better than nothing.
215  for( const auto& name : names )
216  {
217  if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
218  newLibNames.Add( name );
219  }
220 
221  if( !newLibNames.IsEmpty() )
222  {
223  msg = _( "There are library names in the loaded schematic that are missing "
224  "from the project library table. This may result in broken symbol "
225  "library links for the loaded schematic. Do you wish to continue?" );
226  wxMessageDialog msgDlg3( this, msg, _( "Continue Load Schematic" ),
227  wxOK | wxCANCEL | wxCANCEL_DEFAULT |
228  wxCENTER | wxICON_QUESTION );
229  msgDlg3.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
230 
231  if( msgDlg3.ShowModal() == wxID_CANCEL )
232  return false;
233  }
234  }
235  else if( fileName.GetPathWithSep() != Prj().GetProjectPath() )
236  {
237  // A schematic loaded from a path other than the current project path.
238 
239  // If there are symbol libraries in the imported schematic that are not in the
240  // symbol library table of this project, there could be a lot of broken symbol
241  // library links. Attempt to add the missing libraries to the project symbol
242  // library table.
243  wxArrayString duplicateLibNames;
244 
245  for( const auto& name : names )
246  {
247  if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
248  newLibNames.Add( name );
249  else
250  duplicateLibNames.Add( name );
251  }
252 
253  SYMBOL_LIB_TABLE table;
254  wxFileName symLibTableFn( fileName.GetPath(),
256 
257  // If there are any new or duplicate libraries, check to see if it's possible that
258  // there could be any missing libraries that would cause broken symbol library links.
259  if( !newLibNames.IsEmpty() || !duplicateLibNames.IsEmpty() )
260  {
261  if( !symLibTableFn.Exists() || !symLibTableFn.IsFileReadable() )
262  {
263  msg.Printf( _( "The project library table \"%s\" does not exist or cannot "
264  "be read. This may result in broken symbol links for the "
265  "schematic. Do you wish to continue?" ),
266  fileName.GetFullPath() );
267  wxMessageDialog msgDlg4( this, msg, _( "Continue Load Schematic" ),
268  wxOK | wxCANCEL | wxCANCEL_DEFAULT |
269  wxCENTER | wxICON_QUESTION );
270  msgDlg4.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
271 
272  if( msgDlg4.ShowModal() == wxID_CANCEL )
273  return false;
274  }
275  else
276  {
277  try
278  {
279  table.Load( symLibTableFn.GetFullPath() );
280  }
281  catch( const IO_ERROR& ioe )
282  {
283  msg.Printf( _( "An error occurred loading the symbol library table \"%s\"." ),
284  symLibTableFn.GetFullPath() );
285  DisplayErrorMessage( NULL, msg, ioe.What() );
286  return false;
287  }
288  }
289  }
290 
291  // Check to see if any of the symbol libraries found in the appended schematic do
292  // not exist in the current project are missing from the appended project symbol
293  // library table.
294  if( !newLibNames.IsEmpty() )
295  {
296  bool missingLibNames = table.IsEmpty();
297 
298  if( !missingLibNames )
299  {
300  for( const auto& newLibName : newLibNames )
301  {
302  if( !table.HasLibrary( newLibName ) )
303  {
304  missingLibNames = true;
305  break;
306  }
307  }
308  }
309 
310  if( missingLibNames )
311  {
312  msg = _( "There are library names in the loaded schematic that are missing "
313  "from the loaded schematic project library table. This may result "
314  "in broken symbol library links for the schematic. "
315  "Do you wish to continue?" );
316  wxMessageDialog msgDlg5( this, msg, _( "Continue Load Schematic" ),
317  wxOK | wxCANCEL | wxCANCEL_DEFAULT |
318  wxCENTER | wxICON_QUESTION );
319  msgDlg5.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
320 
321  if( msgDlg5.ShowModal() == wxID_CANCEL )
322  return false;
323  }
324  }
325 
326  // The library name already exists in the current project. Check to see if the
327  // duplicate name is the same library in the current project. If it's not, it's
328  // most likely that the symbol library links will be broken.
329  if( !duplicateLibNames.IsEmpty() && !table.IsEmpty() )
330  {
331  bool libNameConflict = false;
332 
333  for( const auto& duplicateLibName : duplicateLibNames )
334  {
335  const SYMBOL_LIB_TABLE_ROW* thisRow = nullptr;
336  const SYMBOL_LIB_TABLE_ROW* otherRow = nullptr;
337 
338  if( Prj().SchSymbolLibTable()->HasLibrary( duplicateLibName ) )
339  thisRow = Prj().SchSymbolLibTable()->FindRow( duplicateLibName );
340 
341  if( table.HasLibrary( duplicateLibName ) )
342  otherRow = table.FindRow( duplicateLibName );
343 
344  // It's in the global library table so there is no conflict.
345  if( thisRow && !otherRow )
346  continue;
347 
348  if( !thisRow || !otherRow )
349  continue;
350 
351  wxFileName otherUriFileName;
352  wxString thisURI = thisRow->GetFullURI( true );
353  wxString otherURI = otherRow->GetFullURI( false);
354 
355  if( otherURI.Contains( "${KIPRJMOD}" ) || otherURI.Contains( "$(KIPRJMOD)" ) )
356  {
357  // Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
358  // not expand to a valid symbol library path.
359  otherUriFileName.SetPath( fileName.GetPath() );
360  otherUriFileName.SetFullName( otherURI.AfterLast( '}' ) );
361  otherURI = otherUriFileName.GetFullPath();
362  }
363 
364  if( thisURI != otherURI )
365  {
366  libNameConflict = true;
367  break;
368  }
369  }
370 
371  if( libNameConflict )
372  {
373  msg = _( "A duplicate library name that references a different library exists "
374  "in the current library table. This conflict cannot be resolved and "
375  "may result in broken symbol library links for the schematic. "
376  "Do you wish to continue?" );
377  wxMessageDialog msgDlg6( this, msg, _( "Continue Load Schematic" ),
378  wxOK | wxCANCEL | wxCANCEL_DEFAULT |
379  wxCENTER | wxICON_QUESTION );
380  msgDlg6.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
381 
382  if( msgDlg6.ShowModal() == wxID_CANCEL )
383  return false;
384  }
385  }
386 
387  // All (most?) of the possible broken symbol library link cases are covered. Map the
388  // new appended schematic project symbol library table entries to the current project
389  // symbol library table.
390  if( !newLibNames.IsEmpty() && !table.IsEmpty() )
391  {
392  for( const wxString& libName : newLibNames )
393  {
394  if( !table.HasLibrary( libName )
395  || Prj().SchSymbolLibTable()->HasLibrary( libName ) )
396  {
397  continue;
398  }
399 
400  // Don't expand environment variable because KIPRJMOD will not be correct
401  // for a different project.
402  wxString uri = table.GetFullURI( libName, false );
403  wxFileName newLib;
404 
405  if( uri.Contains( "${KIPRJMOD}" ) || uri.Contains( "$(KIPRJMOD)" ) )
406  {
407  // Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
408  // not expand to a valid symbol library path.
409  newLib.SetPath( fileName.GetPath() );
410  newLib.SetFullName( uri.AfterLast( '}' ) );
411  uri = newLib.GetFullPath();
412  }
413  else
414  {
415  uri = table.GetFullURI( libName );
416  }
417 
418  // Add the library from the imported project to the current project
419  // symbol library table.
420  const SYMBOL_LIB_TABLE_ROW* row = table.FindRow( libName );
421 
422  wxCHECK( row, false );
423 
424  SYMBOL_LIB_TABLE_ROW* newRow = new SYMBOL_LIB_TABLE_ROW( libName, uri,
425  row->GetType(),
426  row->GetOptions(),
427  row->GetDescr() );
428 
429  Prj().SchSymbolLibTable()->InsertRow( newRow );
430  libTableChanged = true;
431  }
432  }
433  }
434 
435  SCH_SCREEN* newScreen = newSheet->GetScreen();
436  wxCHECK_MSG( newScreen, false, "No screen defined for sheet." );
437 
438  // Set all sheets loaded into the correct sheet file paths.
439 
440  for( SCH_ITEM* aItem : currentScreen->Items().OfType( SCH_SHEET_T ) )
441  {
442  SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
443 
444  if( wxFileName( sheet->GetFileName() ).IsRelative( wxPATH_UNIX ) )
445  sheet->SetFileName( topLevelSheetPath + sheet->GetFileName() );
446  }
447 
448  if( libTableChanged )
449  {
450  Prj().SchSymbolLibTable()->Save( Prj().GetProjectPath() +
452  }
453 
454  // It is finally safe to add or append the imported schematic.
455  if( aSheet->GetScreen() == nullptr )
456  aSheet->SetScreen( newScreen );
457  else
458  aSheet->GetScreen()->Append( newScreen );
459 
460  SCH_SCREENS allScreens( Schematic().Root() );
461  allScreens.ReplaceDuplicateTimeStamps();
462 
463  return true;
464 }
465 
466 
468  bool* aClearAnnotationNewItems )
469 {
470  if( aSheet == NULL || aHierarchy == NULL )
471  return false;
472 
473  // Get the new texts
474  DIALOG_SHEET_PROPERTIES dlg( this, aSheet, aClearAnnotationNewItems );
475 
476  if( dlg.ShowModal() == wxID_CANCEL )
477  return false;
478 
479  return true;
480 }
481 
482 
484 {
485  wxRect DrawArea;
486  BASE_SCREEN* screen = GetScreen();
487 
488  DrawArea.SetSize( GetPageSizeIU() );
489 
490  // Calculate a reasonable dc size, in pixels, and the dc scale to fit
491  // the drawings into the dc size
492  // scale is the ratio resolution (in PPI) / internal units
493  double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
494  double inch2Iu = 1000.0 * IU_PER_MILS;
495  double scale = ppi / inch2Iu;
496 
497  wxSize dcsize = DrawArea.GetSize();
498 
499  int maxdim = std::max( dcsize.x, dcsize.y );
500 
501  // the max size in pixels of the bitmap used to build the sheet copy
502  const int maxbitmapsize = 5600;
503 
504  while( int( maxdim * scale ) > maxbitmapsize )
505  {
506  ppi = ppi / 1.5;
507  scale = ppi / inch2Iu;
508  }
509 
510  dcsize.x *= scale;
511  dcsize.y *= scale;
512 
513  // Set draw offset, zoom... to values needed to draw in the memory DC
514  // after saving initial values:
515  wxPoint tmp_startvisu = screen->m_StartVisu;
516  wxPoint old_org = screen->m_DrawOrg;
517  screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
518  screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
519 
520  wxMemoryDC dc;
521  wxBitmap image( dcsize );
522  dc.SelectObject( image );
523  dc.Clear();
524 
525  GRResetPenAndBrush( &dc );
526  GRForceBlackPen( false );
527  dc.SetUserScale( scale, scale );
528 
529  GetRenderSettings()->SetPrintDC( &dc );
530  // Init the color of the layer actually used to print the worksheet:
533 
535 
536  {
537  wxLogNull doNotLog; // disable logging of failed clipboard actions
538 
539  if( wxTheClipboard->Open() )
540  {
541  // This data objects are held by the clipboard, so do not delete them in the app.
542  wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image );
543  wxTheClipboard->SetData( clipbrd_data );
544  wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
545  wxTheClipboard->Close();
546  }
547  }
548 
549  // Deselect Bitmap from DC in order to delete the MemoryDC
550  dc.SelectObject( wxNullBitmap );
551 
552  GRForceBlackPen( false );
553 
554  screen->m_StartVisu = tmp_startvisu;
555  screen->m_DrawOrg = old_org;
556 }
557 
558 
559 bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aSchematicFileName )
560 {
561  wxString msg;
562  SCH_SCREENS screens( Schematic().Root() );
563  wxFileName fn = aSchematicFileName;
564 
565  wxCHECK( fn.IsAbsolute(), false );
566 
568  && screens.CanCauseCaseSensitivityIssue( aSchematicFileName ) )
569  {
570  msg.Printf( _( "The file name \"%s\" can cause issues with an existing file name\n"
571  "already defined in the schematic on systems that support case\n"
572  "insensitive file names. This will cause issues if you copy this\n"
573  "project to an operating system that supports case insensitive file\n"
574  "names.\n\nDo you wish to continue?" ),
575  fn.GetName() );
576 
577  wxRichMessageDialog dlg( this, msg, _( "Warning" ),
578  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
579  dlg.ShowCheckBox( _( "Do not show this message again." ) );
580  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Create New Sheet" ) ),
581  wxMessageDialog::ButtonLabel( _( "Discard New Sheet" ) ) );
582 
583  if( dlg.ShowModal() == wxID_NO )
584  return false;
585 
587  !dlg.IsCheckBoxChecked();
588  }
589 
590  return true;
591 }
bool CheckSheetForRecursion(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Verify that aSheet will not cause a recursion error in aHierarchy.
Definition: sheet.cpp:46
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:216
static const wxString & GetSymbolLibTableFileName()
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:118
const wxString & GetFileName() const
Definition: sch_screen.h:133
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:265
virtual void PrintPage(const RENDER_SETTINGS *aSettings) override
Plot or print the current sheet to the clipboard.
This file is part of the common library.
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:156
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper to retrieve a layer color from the global color settings.
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition: sheet.cpp:95
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
Definition: sheet.cpp:483
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:103
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:123
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
const wxString & GetDescr() const
Return the description of the library referenced by this row.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static SCH_FILE_T GuessPluginTypeFromSchPath(const wxString &aSchematicPath)
Return a plugin type given a schematic using the file extension of aSchematicPath.
Definition: sch_io_mgr.cpp:169
wxPoint m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
Definition: base_screen.h:97
Definition: kiid.h:44
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Test every SCH_SHEET_PATH in this SCH_SHEET_LIST to verify if adding the sheets stored in aSrcSheetHi...
void SetFileName(wxString aFilename)
Definition: sch_sheet.h:321
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
Definition: sheet.cpp:103
bool AllowCaseSensitiveFileNameClashes(const wxString &aSchematicFileName)
Check aSchematicFileName for a potential file name case sensitivity clashes.
Definition: sheet.cpp:559
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:199
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:40
const wxString GetType() const override
Return the type of symbol library table represented by this row.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:315
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Definition: sch_io_mgr.h:473
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
const int scale
SCH_SCREEN * LastScreen()
const char * name
Definition: DXF_plotter.cpp:59
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:128
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:103
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:92
#define IU_PER_MILS
Definition: plotter.cpp:137
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:467
int ReplaceDuplicateTimeStamps()
Test all sheet and component objects in the schematic for duplicate time stamps and replaces them as ...
bool CanCauseCaseSensitivityIssue(const wxString &aSchematicFileName) const
Check aSchematicFileName for a potential file name case sensitivity issue.
drawingsheet frame and titleblock
void SetFileName(const wxString &aFileName)
Definition: sch_screen.h:131
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
bool checkForNoFullyDefinedLibIds(SCH_SHEET *aSheet)
Verify that the symbol library links aSheet and all of it's child sheets have been remapped to the sy...
Definition: sheet.cpp:74
void SetModify()
Definition: base_screen.h:59
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:280
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
void SetPrintDC(wxDC *aDC)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:549
bool IsEmpty(bool aIncludeFallback=true)
Return true if the table is empty.