KiCad PCB EDA Suite
schframe.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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2016 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 
29 #include <fctsys.h>
30 #include <kiface_i.h>
31 #include <pgm_base.h>
32 #include <gr_basic.h>
33 #include <class_drawpanel.h>
34 #include <gestfich.h>
35 #include <confirm.h>
36 #include <base_units.h>
37 #include <msgpanel.h>
38 #include <html_messagebox.h>
39 #include <executable_names.h>
40 
41 #include <general.h>
42 #include <eeschema_id.h>
43 #include <netlist.h>
44 #include <lib_pin.h>
45 #include <class_library.h>
46 #include <schframe.h>
47 #include <sch_component.h>
48 
49 #include <dialog_helpers.h>
50 #include <libeditframe.h>
51 #include <viewlib_frame.h>
52 #include <hotkeys.h>
53 #include <eeschema_config.h>
54 #include <sch_sheet.h>
55 #include <sch_sheet_path.h>
56 #include "sim/sim_plot_frame.h"
57 
58 #include <invoke_sch_dialog.h>
60 
61 #include <wx/display.h>
62 #include <build_version.h>
64 
65 #include <netlist_exporter_kicad.h>
66 #include <kiway.h>
67 
68 
69 // non-member so it can be moved easily, and kept REALLY private.
70 // Do NOT Clear() in here.
71 static void add_search_paths( SEARCH_STACK* aDst, const SEARCH_STACK& aSrc, int aIndex )
72 {
73  for( unsigned i=0; i<aSrc.GetCount(); ++i )
74  aDst->AddPaths( aSrc[i], aIndex );
75 }
76 
77 
78 // non-member so it can be moved easily, and kept REALLY private.
79 // Do NOT Clear() in here.
80 static void add_search_paths( SEARCH_STACK* aDst, wxConfigBase* aCfg, int aIndex )
81 {
82  for( int i=1; true; ++i )
83  {
84  wxString key = wxString::Format( wxT( "LibraryPath%d" ), i );
85  wxString upath = aCfg->Read( key, wxEmptyString );
86 
87  if( !upath )
88  break;
89 
90  aDst->AddPaths( upath, aIndex );
91  }
92 }
93 
94 //-----<SCH "data on demand" functions>-------------------------------------------
95 
96 SEARCH_STACK* PROJECT::SchSearchS()
97 {
99 
100  wxASSERT( !ss || dynamic_cast<SEARCH_STACK*>( GetElem( PROJECT::ELEM_SCH_SEARCH_STACK ) ) );
101 
102  if( !ss )
103  {
104  ss = new SEARCH_STACK();
105 
106  // Make PROJECT the new SEARCH_STACK owner.
108 
109  // to the empty SEARCH_STACK for SchSearchS(), add project dir as first
110  ss->AddPaths( m_project_name.GetPath() );
111 
112  // next add the paths found in *.pro, variable "LibDir"
113  wxString libDir;
114 
115  try
116  {
117  PART_LIBS::LibNamesAndPaths( this, false, &libDir );
118  }
119  catch( const IO_ERROR& DBG( ioe ) )
120  {
121  DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
122  }
123 
124  if( !!libDir )
125  {
126  wxArrayString paths;
127 
128  SEARCH_STACK::Split( &paths, libDir );
129 
130  for( unsigned i =0; i<paths.GetCount(); ++i )
131  {
132  wxString path = AbsolutePath( paths[i] );
133 
134  ss->AddPaths( path ); // at the end
135  }
136  }
137 
138  // append all paths from aSList
139  add_search_paths( ss, Kiface().KifaceSearch(), -1 );
140 
141  // addLibrarySearchPaths( SEARCH_STACK* aSP, wxConfigBase* aCfg )
142  // This is undocumented, but somebody wanted to store !schematic!
143  // library search paths in the .kicad_common file?
144  add_search_paths( ss, Pgm().CommonSettings(), -1 );
145  }
146 
147  return ss;
148 }
149 
150 
151 PART_LIBS* PROJECT::SchLibs()
152 {
154 
155  wxASSERT( !libs || dynamic_cast<PART_LIBS*>( libs ) );
156 
157  if( !libs )
158  {
159  libs = new PART_LIBS();
160 
161  // Make PROJECT the new PART_LIBS owner.
163 
164  try
165  {
166  libs->LoadAllLibraries( this );
167  }
168  catch( const PARSE_ERROR& pe )
169  {
170  wxString lib_list = UTF8( pe.inputLine );
171  wxWindow* parent = 0; // Pgm().App().GetTopWindow();
172 
173  // parent of this dialog cannot be NULL since that breaks the Kiway() chain.
174  HTML_MESSAGE_BOX dlg( parent, _( "Not Found" ) );
175 
176  dlg.MessageSet( _( "The following libraries were not found:" ) );
177 
178  dlg.ListSet( lib_list );
179 
180  dlg.Layout();
181 
182  dlg.ShowModal();
183  }
184  catch( const IO_ERROR& ioe )
185  {
186  DisplayError( NULL, ioe.What() );
187  }
188  }
189 
190  return libs;
191 }
192 
193 /*
194 NETLIST_OBJECT_LIST* PROJECT::Netlist()
195 {
196  NETLIST_OBJECT_LIST* netlist = (NETLIST_OBJECT_LIST*) GetElem( PROJECT::ELEM_SCH_NETLIST );
197 
198  wxASSERT( !libs || dynamic_cast<NETLIST_OBJECT_LIST*>( netlist ) );
199 
200  if( !netlist )
201  {
202  netlist = new NETLIST_OBJECT_LIST();
203 
204  // Make PROJECT the new NETLIST_OBJECT_LIST owner.
205  SetElem( PROJECT::ELEM_SCH_NETLIST, netlist );
206  }
207 }
208 */
209 
210 //-----</SCH "data on demand" functions>------------------------------------------
211 
212 
213 BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
214  EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, EDA_DRAW_FRAME::OnSockRequestServer )
215  EVT_SOCKET( ID_EDA_SOCKET_EVENT, EDA_DRAW_FRAME::OnSockRequest )
216 
217  EVT_CLOSE( SCH_EDIT_FRAME::OnCloseWindow )
218  EVT_SIZE( SCH_EDIT_FRAME::OnSize )
219 
220  EVT_MENU( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
221  EVT_MENU( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
222 
223  EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, SCH_EDIT_FRAME::OnLoadFile )
224 
225  EVT_MENU( ID_APPEND_PROJECT, SCH_EDIT_FRAME::OnAppendProject )
226 
227  EVT_TOOL( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
228  EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
229 
230  EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject )
235  EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
236 
237  EVT_MENU( ID_POPUP_SCH_COPY_ITEM, SCH_EDIT_FRAME::OnCopySchematicItemRequest )
238 
239  EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
240  EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
241  EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
243  SCH_EDIT_FRAME::Process_Config )
244 
245  EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions )
246 
247  EVT_TOOL( ID_RUN_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
249  EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
250  EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
251 
252  EVT_TOOL( ID_RUN_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
253  EVT_TOOL( ID_RUN_PCB_MODULE_EDITOR, SCH_EDIT_FRAME::OnOpenPcbModuleEditor )
254 
255  EVT_TOOL( ID_RUN_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb )
256 
257  EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
258  EVT_TOOL( ID_HIERARCHY, SCH_EDIT_FRAME::Process_Special_Functions )
259  EVT_TOOL( wxID_CUT, SCH_EDIT_FRAME::Process_Special_Functions )
260  EVT_TOOL( wxID_COPY, SCH_EDIT_FRAME::Process_Special_Functions )
261  EVT_TOOL( wxID_PASTE, SCH_EDIT_FRAME::Process_Special_Functions )
262  EVT_TOOL( wxID_UNDO, SCH_EDIT_FRAME::GetSchematicFromUndoList )
263  EVT_TOOL( wxID_REDO, SCH_EDIT_FRAME::GetSchematicFromRedoList )
264  EVT_TOOL( ID_GET_ANNOTATE, SCH_EDIT_FRAME::OnAnnotate )
265  EVT_TOOL( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
267  EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
269  EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
270  EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
271  EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
272  EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
274  EVT_TOOL( ID_AUTOPLACE_FIELDS, SCH_EDIT_FRAME::OnAutoplaceFields )
275  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
276  EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
277  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
278  EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
279 
280  // Tools and buttons for vertical toolbar.
282  EVT_TOOL( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnSelectTool )
283  EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
285  SCH_EDIT_FRAME::OnSelectTool )
286 
287 #ifdef KICAD_SPICE
289  EVT_TOOL( ID_SIM_PROBE, SCH_EDIT_FRAME::OnSelectTool )
290  EVT_TOOL( ID_SIM_TUNE, SCH_EDIT_FRAME::OnSelectTool )
291 #endif /* KICAD_SPICE */
292 
296  SCH_EDIT_FRAME::OnRotate )
298  SCH_EDIT_FRAME::OnEditItem )
301  SCH_EDIT_FRAME::Process_Special_Functions )
302 
303  // Tools and buttons options toolbar
304  EVT_TOOL( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnSelectOptionToolbar )
305  EVT_TOOL( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnSelectOptionToolbar )
306 
308  SCH_EDIT_FRAME::Process_Special_Functions )
310  SCH_EDIT_FRAME::OnSelectUnit )
312  SCH_EDIT_FRAME::OnConvertTextType )
313 
314  // Multple item selection context menu commands.
316 
317  /* Handle user interface update events. */
318  EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
319  EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
320  EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
321  EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
322  EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
323  EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
324  EVT_UPDATE_UI( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnUpdateSelectTool )
325  EVT_UPDATE_UI( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnUpdateSelectTool )
326  EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
327  SCH_EDIT_FRAME::OnUpdateSelectTool )
328  EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
329  EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
330  EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
331 
332  /* Search dialog events. */
333  EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
334  EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker )
335  EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem )
336  EVT_FIND_REPLACE( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
337  EVT_FIND_REPLACE_ALL( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
338 
339 END_EVENT_TABLE()
340 
341 
342 SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
343  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
344  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
345  m_item_to_repeat( 0 )
346 {
347  m_showAxis = false; // true to show axis
348  m_showBorderAndTitleBlock = true; // true to show sheet references
349  m_CurrentSheet = new SCH_SHEET_PATH;
350  m_DefaultSchematicFileName = NAMELESS_PROJECT;
351  m_DefaultSchematicFileName += wxT( ".sch" );
352  m_showAllPins = false;
353  m_previewPosition = wxDefaultPosition;
354  m_previewSize = wxDefaultSize;
355  m_printMonochrome = true;
356  m_printSheetReference = true;
357  SetShowPageLimits( true );
358  m_hotkeysDescrList = g_Schematic_Hokeys_Descr;
359  m_dlgFindReplace = NULL;
360  m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
361  m_undoItem = NULL;
362  m_hasAutoSave = true;
363 
364  SetForceHVLines( true );
365  SetSpiceAjustPassiveValues( false );
366 
367  // Give an icon
368  wxIcon icon;
369  icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
370  SetIcon( icon );
371 
372  // Initialize grid id to the default value (50 mils):
373  const int default_grid = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
374  m_LastGridSizeId = default_grid;
375 
376  LoadSettings( config() );
377 
378  CreateScreens();
379 
380  // Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range
381  if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
382  m_LastGridSizeId = default_grid;
383 
384  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
385 
386  if( m_canvas )
387  m_canvas->SetEnableBlockCommands( true );
388 
389  ReCreateMenuBar();
390  ReCreateHToolbar();
391  ReCreateVToolbar();
392  ReCreateOptToolbar();
393 
394  // Initialize common print setup dialog settings.
395  m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
396  m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
397  m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
398  m_pageSetupData.GetPrintData().SetNoCopies( 1 );
399 
400  m_auimgr.SetManagedWindow( this );
401 
402  EDA_PANEINFO horiz;
403  horiz.HorizontalToolbarPane();
404 
405  EDA_PANEINFO vert;
406  vert.VerticalToolbarPane();
407 
408  EDA_PANEINFO mesg;
409  mesg.MessageToolbarPane();
410 
411  if( m_mainToolBar )
412  m_auimgr.AddPane( m_mainToolBar,
413  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
414 
415  if( m_drawToolBar )
416  m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );
417 
418  if( m_optionsToolBar )
419  m_auimgr.AddPane( m_optionsToolBar,
420  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
421 
422  if( m_canvas )
423  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
424 
425  if( m_messagePanel )
426  m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
427  Layer(10) );
428 
429  m_auimgr.Update();
430 
431  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
432  GetScreen()->SetZoom( BestZoom() );
433 
434  Zoom_Automatique( false );
435 
436  // Net list generator
437  DefaultExecFlags();
438 }
439 
440 
442 {
443  delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
444 
445  SetScreen( NULL );
446 
447  delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
448  delete m_undoItem;
449  delete g_RootSheet;
450  delete m_findReplaceData;
451 
452  m_CurrentSheet = NULL;
453  m_undoItem = NULL;
454  g_RootSheet = NULL;
455  m_findReplaceData = NULL;
456 }
457 
458 
460 {
461  // we cannot store a pointer to an item in the display list here since
462  // that item may be deleted, such as part of a line concatonation or other.
463  // So simply always keep a copy of the object which is to be repeated.
464 
465  SCH_ITEM* old = m_item_to_repeat;
466  SCH_ITEM* cur = aItem;
467 
468  if( cur != old )
469  {
470  if( cur )
471  {
472  aItem = (SCH_ITEM*) cur->Clone();
473 
474  // Clone() preserves the flags, we want 'em cleared.
475  aItem->ClearFlags();
476  }
477 
478  m_item_to_repeat = aItem;
479 
480  delete old;
481  }
482 }
483 
484 
486 {
487  SCH_SCREEN* screen;
488  SCH_SCREENS s_list;
489 
490  /* Set the sheet count, and the sheet number (1 for root sheet)
491  */
492  int sheet_count = g_RootSheet->CountSheets();
493  int SheetNumber = 1;
494  wxString current_sheetpath = m_CurrentSheet->Path();
495  SCH_SHEET_LIST sheetList( g_RootSheet );
496 
497  // Examine all sheets path to find the current sheets path,
498  // and count them from root to the current sheet path:
499  for( unsigned i = 0; i < sheetList.size(); i++ )
500  {
501  wxString sheetpath = sheetList[i].Path();
502 
503  if( sheetpath == current_sheetpath ) // Current sheet path found
504  break;
505 
506  SheetNumber++; /* Not found, increment sheet
507  * number before this current
508  * path */
509  }
510 
511  for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
512  {
513  screen->m_NumberOfScreens = sheet_count;
514  }
515 
516  GetScreen()->m_ScreenNumber = SheetNumber;
517 }
518 
519 
521 {
522  return m_CurrentSheet->LastScreen();
523 }
524 
525 
527 {
528  wxString s = m_CurrentSheet->PathHumanReadable();
529 
530  return s;
531 }
532 
533 
535 {
536  if( g_RootSheet == NULL )
537  {
538  g_RootSheet = new SCH_SHEET();
539  }
540 
541  if( g_RootSheet->GetScreen() == NULL )
542  {
543  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
544  screen->SetMaxUndoItems( m_UndoRedoCountMax );
545  g_RootSheet->SetScreen( screen );
546  SetScreen( g_RootSheet->GetScreen() );
547  }
548 
549  g_RootSheet->GetScreen()->SetFileName( m_DefaultSchematicFileName );
550 
551  m_CurrentSheet->clear();
552  m_CurrentSheet->push_back( g_RootSheet );
553 
554  if( GetScreen() == NULL )
555  {
556  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
557  screen->SetMaxUndoItems( m_UndoRedoCountMax );
558  SetScreen( screen );
559  }
560 
561  GetScreen()->SetZoom( 32.0 );
562 }
563 
564 
566 {
567  wxASSERT_MSG( m_CurrentSheet != NULL, wxT( "SCH_EDIT_FRAME m_CurrentSheet member is NULL." ) );
568 
569  return *m_CurrentSheet;
570 }
571 
572 
574 {
575  *m_CurrentSheet = aSheet;
576 }
577 
578 
580 {
581  // if aItem != NULL, delete a previous m_undoItem, if exists
582  // if aItme = NULL, just clear m_undoItem,
583  // because when calling SetUndoItem( NULL ), we only clear m_undoItem,
584  // because the owner of m_undoItem is no more me.
585  if( aItem && m_undoItem )
586  {
587  delete m_undoItem;
588  }
589 
590  m_undoItem = NULL;
591 
592  if( aItem )
593  m_undoItem = (SCH_ITEM*) aItem->Clone();
594 }
595 
596 
598 {
599  wxCHECK_RET( aItem != NULL,
600  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
601  wxCHECK_RET( m_undoItem != NULL,
602  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
603  wxCHECK_RET( aItem->Type() == m_undoItem->Type(),
604  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
605 
606  aItem->SwapData( m_undoItem );
607  SaveCopyInUndoList( aItem, UR_CHANGED );
608  aItem->SwapData( m_undoItem );
609 }
610 
611 
612 void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
613 {
614  if( Kiface().IsSingle() )
615  {
616  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
617  if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
618  return;
619 
620  LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
621  if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
622  return;
623 
624  viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
625  if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer?
626  return;
627  }
628 
629  SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
630 
631  if( simFrame && !simFrame->Close() ) // Can close the simulator?
632  return;
633 
634  SCH_SHEET_LIST sheetList( g_RootSheet );
635 
636  if( sheetList.IsModified() )
637  {
638  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
639  wxString msg = wxString::Format( _(
640  "Save the changes in\n'%s'\nbefore closing?"),
641  GetChars( fileName )
642  );
643 
644  int ii = DisplayExitDialog( this, msg );
645 
646  switch( ii )
647  {
648  case wxID_CANCEL:
649  aEvent.Veto();
650  return;
651 
652  case wxID_NO:
653  break;
654 
655  case wxID_YES:
656  wxCommandEvent tmp( ID_SAVE_PROJECT );
657  OnSaveProject( tmp );
658  break;
659  }
660  }
661 
662  // Close the find dialog and preserve it's setting if it is displayed.
663  if( m_dlgFindReplace )
664  {
665  m_findDialogPosition = m_dlgFindReplace->GetPosition();
666  m_findDialogSize = m_dlgFindReplace->GetSize();
667  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
668  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
669  m_dlgFindReplace->Destroy();
670  m_dlgFindReplace = NULL;
671  }
672 
673  SCH_SCREENS screens;
674  wxFileName fn;
675 
676  for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
677  {
678  fn = Prj().AbsolutePath( screen->GetFileName() );
679 
680  // Auto save file name is the normal file name prepended with AUTOSAVE_PREFIX_FILENAME.
681  fn.SetName( AUTOSAVE_PREFIX_FILENAME + fn.GetName() );
682 
683  if( fn.FileExists() && fn.IsFileWritable() )
684  wxRemoveFile( fn.GetFullPath() );
685  }
686 
687  sheetList.ClearModifyStatus();
688 
689  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
690 
691  if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty() &&
692  g_RootSheet->GetScreen()->GetDrawItems() != NULL )
693  {
694  UpdateFileHistory( fileName );
695  }
696 
698 
699  // all sub sheets are deleted, only the main sheet is usable
700  m_CurrentSheet->clear();
701 
702  Destroy();
703 }
704 
705 
707 {
708  int dx, dy;
709  wxSize size;
710 
711  dx = GetScreen()->GetPageSettings().GetWidthIU();
712  dy = GetScreen()->GetPageSettings().GetHeightIU();
713 
714  size = m_canvas->GetClientSize();
715 
716  // Reserve no margin because best zoom shows the full page
717  // and margins are already included in function that draws the sheet refernces
718  double margin_scale_factor = 1.0;
719  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
720  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
721 
722  double bestzoom = std::max( zx, zy );
723 
724  SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
725 
726  return bestzoom;
727 }
728 
729 
731 {
732  wxFileName fn = GetScreen()->GetFileName();
733 
734  // Name is <root sheet filename>-<sheet path> and has no extension.
735  // However if filename is too long name is <sheet filename>-<sheet number>
736 
737  #define FN_LEN_MAX 80 // A reasonable value for the short filename len
738 
739  wxString filename = fn.GetName();
740  wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
741 
742  // Remove the last '/' of the path human readable
743  // (and for the root sheet, make sheetFullName empty):
744  sheetFullName.RemoveLast();
745 
746  sheetFullName.Trim( true );
747  sheetFullName.Trim( false );
748 
749  // Convert path human readable separator to '-'
750  sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
751 
752  if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
753  filename += sheetFullName;
754  else
755  filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
756 
757  return filename;
758 }
759 
760 
762 {
763  GetScreen()->SetModify();
764  GetScreen()->SetSave();
765 
766  m_foundItems.SetForceSearch();
767 }
768 
769 
770 void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
771 {
772  bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE );
773 
774  event.Enable( enable );
775 }
776 
777 
778 void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
779 {
780  event.Enable( m_blockItems.GetCount() > 0 );
781 }
782 
783 
784 void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
785 {
786  wxString tool_tip = GetForceHVLines() ?
787  _( "Draw wires and buses in any direction" ) :
788  _( "Draw horizontal and vertical wires and buses only" );
789 
790  aEvent.Check( GetForceHVLines() );
791  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
792 }
793 
794 
795 void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
796 {
797  wxString tool_tip = m_showAllPins ? _( "Do not show hidden pins" ) :
798  _( "Show hidden pins" );
799 
800  aEvent.Check( m_showAllPins );
801  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
802 }
803 
804 
805 void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
806 {
807  SCH_SHEET_LIST sheetList( g_RootSheet );
808 
809  aEvent.Enable( sheetList.IsModified() );
810 }
811 
812 
813 void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
814 {
815  aEvent.Enable( GetScreen()->IsModify() );
816 
817 }
818 
819 
820 void SCH_EDIT_FRAME::OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent )
821 {
822  aEvent.Enable( m_CurrentSheet->Last() != g_RootSheet );
823 }
824 
825 
826 void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
827 {
828  InvokeDialogAnnotate( this );
829 }
830 
831 
832 void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
833 {
834  // See if it's already open...
835  wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
836 
837  if( erc )
838  // Bring it to the top if already open. Dual monitor users need this.
839  erc->Raise();
840  else
841  InvokeDialogERC( this );
842 }
843 
844 void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
845 {
846  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
847 
848  fn.SetExt( PcbFileExtension );
849 
850  if( Kiface().IsSingle() )
851  {
852  DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is"
853  " opened in stand-alone mode. In order to create/update"
854  " PCBs from schematics, you need to launch Kicad shell"
855  " and create a PCB project." ) );
856  return;
857  }
858  else
859  {
860  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
861 
862  // a pcb frame can be already existing, but not yet used.
863  // this is the case when running the footprint editor, or the footprint viewer first
864  // if the frame is not visible, the board is not yet loaded
865  if( !frame->IsVisible() )
866  {
867  frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
868  frame->Show( true );
869  }
870 
871  // On Windows, Raise() does not bring the window on screen, when iconized
872  if( frame->IsIconized() )
873  frame->Iconize( false );
874 
875  frame->Raise();
876  }
877 
878  // Ensure the schematic is OK for a netlist creation
879  // (especially all components are annotated):
880  bool success = prepareForNetlist();
881 
882  if( !success )
883  return;
884 
885  NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
886  NETLIST_EXPORTER_KICAD exporter( net_atoms, Prj().SchLibs() );
887  STRING_FORMATTER formatter;
888 
889  exporter.Format( &formatter, GNL_ALL );
890 
891  // Now, send the "kicad" (s-expr) netlist to Pcbnew
893  formatter.GetString(), this );
894 }
895 
896 void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
897 {
898  int result;
899 
900  do
901  {
902  result = InvokeDialogNetList( this );
903 
904  // If a plugin is removed or added, rebuild and reopen the new dialog
905 
906  } while( result == NET_PLUGIN_CHANGE );
907 }
908 
909 
911 {
912  InvokeDialogCreateBOM( this );
913 }
914 
915 
916 void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
917 {
918  wxCHECK_RET( m_findReplaceData != NULL,
919  wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
920 
921  if( m_dlgFindReplace )
922  {
923  delete m_dlgFindReplace;
924  m_dlgFindReplace = NULL;
925  }
926 
927  // Verify the find dialog is not drawn off the visible display area in case the
928  // display configuration has changed since the last time the dialog position was
929  // saved.
930  wxRect displayRect = wxDisplay().GetGeometry();
931  wxRect dialogRect = wxRect( m_findDialogPosition, m_findDialogSize );
932 
933  wxPoint position = m_findDialogPosition;
934 
935  if( !displayRect.Contains( dialogRect ) )
936  {
937  position = wxDefaultPosition;
938  }
939 
940  int style = 0;
941 
942  if( aEvent.GetId() == wxID_REPLACE )
943  style = wxFR_REPLACEDIALOG;
944 
945  m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, position, m_findDialogSize,
946  style );
947 
948  m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
949  m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
950  m_dlgFindReplace->Show( true );
951 }
952 
953 
954 void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
955 {
956  // If the user dismissed the dialog with the mouse, this will send the cursor back
957  // to the last item found.
958  OnFindSchematicItem( event );
959 
960  if( m_dlgFindReplace )
961  {
962  m_findDialogPosition = m_dlgFindReplace->GetPosition();
963  m_findDialogSize = m_dlgFindReplace->GetSize();
964  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
965  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
966  m_dlgFindReplace->Destroy();
967  m_dlgFindReplace = NULL;
968  }
969 }
970 
971 
972 void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
973 {
974  wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
975 
976  if( fn.size() )
977  OpenProjectFiles( std::vector<wxString>( 1, fn ) );
978 }
979 
980 
981 void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
982 {
983  LoadCmpToFootprintLinkFile();
984  m_canvas->Refresh();
985 }
986 
987 
988 void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
989 {
990 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
991  wxString pro_dir = m_mruPath;
992 
993  wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
994  wxEmptyString, SchematicFileWildcard,
995  wxFD_SAVE );
996 
997  if( dlg.ShowModal() != wxID_CANCEL )
998  {
999  // Enforce the extension, wxFileDialog is inept.
1000  wxFileName create_me = dlg.GetPath();
1001  create_me.SetExt( SchematicFileExtension );
1002 
1003  if( create_me.FileExists() )
1004  {
1005  wxString msg = wxString::Format( _(
1006  "Schematic file '%s' already exists, use Open instead" ),
1007  GetChars( create_me.GetFullName() )
1008  );
1009  DisplayError( this, msg );
1010  return ;
1011  }
1012 
1013  // OpenProjectFiles() requires absolute
1014  wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
1015 
1016  OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1017  m_mruPath = create_me.GetPath();
1018  }
1019 }
1020 
1021 
1022 void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
1023 {
1024 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
1025  wxString pro_dir = m_mruPath;
1026 
1027  wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
1028  wxEmptyString, SchematicFileWildcard,
1029  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1030 
1031  if( dlg.ShowModal() != wxID_CANCEL )
1032  {
1033  OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1034  m_mruPath = Prj().GetProjectPath();
1035  }
1036 }
1037 
1038 
1039 void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
1040 {
1041  wxFileName kicad_board = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1042 
1043  if( kicad_board.IsOk() )
1044  {
1045  kicad_board.SetExt( PcbFileExtension );
1046  wxFileName legacy_board( kicad_board );
1047  legacy_board.SetExt( LegacyPcbFileExtension );
1048  wxFileName& boardfn = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
1049  kicad_board : legacy_board;
1050 
1051  if( Kiface().IsSingle() )
1052  {
1053  wxString filename = QuoteFullPath( boardfn );
1054  ExecuteFile( this, PCBNEW_EXE, filename );
1055  }
1056  else
1057  {
1058  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
1059 
1060  // a pcb frame can be already existing, but not yet used.
1061  // this is the case when running the footprint editor, or the footprint viewer first
1062  // if the frame is not visible, the board is not yet loaded
1063  if( !frame->IsVisible() )
1064  {
1065  frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1066  frame->Show( true );
1067  }
1068 
1069  // On Windows, Raise() does not bring the window on screen, when iconized
1070  if( frame->IsIconized() )
1071  frame->Iconize( false );
1072 
1073  frame->Raise();
1074  }
1075  }
1076  else
1077  {
1078  ExecuteFile( this, PCBNEW_EXE );
1079  }
1080 }
1081 
1082 
1083 void SCH_EDIT_FRAME::OnOpenPcbModuleEditor( wxCommandEvent& event )
1084 {
1085  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1086 
1087  if( fn.IsOk() )
1088  {
1090 
1091  // On Windows, Raise() does not bring the window on screen, when iconized
1092  if( fp_editor->IsIconized() )
1093  fp_editor->Iconize( false );
1094 
1095  fp_editor->Show( true );
1096  fp_editor->Raise();
1097  }
1098 }
1099 
1100 
1101 void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
1102 {
1103  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1104 
1105  fn.SetExt( NetlistFileExtension );
1106 
1107  if( prepareForNetlist() )
1108  {
1109  KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1110 
1111  if( !player )
1112  {
1113  player = Kiway().Player( FRAME_CVPCB, true );
1114  player->Show( true );
1115  // player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1116  }
1117 
1118  sendNetlist();
1119 
1120  player->Raise();
1121  }
1122 }
1123 
1124 
1125 void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
1126 {
1127  SCH_COMPONENT* component = NULL;
1128 
1129  if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
1130  {
1131  // We want to edit a component with Libedit.
1132  // we are here by a hot key, or by a popup menu
1133  SCH_ITEM* item = GetScreen()->GetCurItem();
1134 
1135  if( !item )
1136  {
1137  // If we didn't get here by a hot key, then something has gone wrong.
1138  if( event.GetInt() == 0 )
1139  return;
1140 
1141  EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) event.GetClientObject();
1142 
1143  wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
1144 
1145  // Set the locat filter, according to the edit command
1146  const KICAD_T* filterList = SCH_COLLECTOR::ComponentsOnly;
1147  item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
1148 
1149  // Exit if no item found at the current location or the item is already being edited.
1150  if( (item == NULL) || (item->GetFlags() != 0) )
1151  return;
1152  }
1153 
1154 
1155  if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
1156  {
1157  wxMessageBox( _( "Error: not a component or no component" ) );
1158  return;
1159  }
1160 
1161  component = (SCH_COMPONENT*) item;
1162  }
1163 
1164  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
1165 
1166  if( !libeditFrame )
1167  {
1168  libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
1169  libeditFrame->Show( true );
1170  }
1171 
1172  libeditFrame->PushPreferences( m_canvas );
1173 
1174  // On Windows, Raise() does not bring the window on screen, when iconized
1175  if( libeditFrame->IsIconized() )
1176  libeditFrame->Iconize( false );
1177 
1178  libeditFrame->Raise();
1179 
1180  if( component )
1181  {
1182  if( PART_LIBS* libs = Prj().SchLibs() )
1183  {
1184  LIB_ALIAS* entry = libs->FindLibraryAlias( component->GetLibId() );
1185 
1186  if( !entry ) // Should not occur
1187  return;
1188 
1189  PART_LIB* library = entry->GetLib();
1190 
1191  libeditFrame->LoadComponentAndSelectLib( entry, library );
1192  }
1193  }
1194 
1195  GetScreen()->SchematicCleanUp();
1196  m_canvas->Refresh();
1197 }
1198 
1199 
1200 void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
1201 {
1202  RescueProject( true );
1203 }
1204 
1205 
1206 void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1207 {
1208  Close( false );
1209 }
1210 
1211 
1212 void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
1213 {
1215 
1216  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1217 
1218  if( fn.GetName() != NAMELESS_PROJECT )
1219  {
1220  // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
1221  Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
1222  GetProjectFileParametersList() );
1223  }
1224 }
1225 
1226 
1227 void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
1228  void* aData )
1229 {
1230  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1231 
1232  GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
1233  DrawWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
1234 }
1235 
1236 
1237 void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
1238 {
1239  int id = aEvent.GetId();
1240  int index = id - ID_SELECT_ITEM_START;
1241 
1242  if( (id >= ID_SELECT_ITEM_START && id <= ID_SELECT_ITEM_END)
1243  && (index >= 0 && index < m_collectedItems.GetCount()) )
1244  {
1245  SCH_ITEM* item = m_collectedItems[index];
1246  m_canvas->SetAbortRequest( false );
1247  GetScreen()->SetCurItem( item );
1248  }
1249 }
1250 
1251 
1253 {
1254  // In case this event happens before g_RootSheet is initialized which does happen
1255  // on mingw64 builds.
1256 
1257  if( g_RootSheet != NULL )
1258  {
1259  SCH_SHEET_LIST sheetList( g_RootSheet );
1260 
1261  return sheetList.IsAutoSaveRequired();
1262  }
1263 
1264  return false;
1265 }
1266 
1267 
1269 {
1270  SCH_SCREEN* screen = GetScreen();
1271  SCH_ITEM* item = screen->GetCurItem();
1272 
1273  wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
1274 
1275  m_canvas->SetAutoPanRequest( false );
1276 
1277  SCH_ITEM* undoItem = item;
1278 
1279  if( item->Type() == SCH_SHEET_PIN_T )
1280  {
1281  SCH_SHEET* sheet = (SCH_SHEET*) item->GetParent();
1282 
1283  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
1284  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
1285 
1286  undoItem = sheet;
1287  }
1288 
1289  else if( item->Type() == SCH_FIELD_T )
1290  {
1291  SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
1292 
1293  wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
1294  wxT( "Cannot place field in invalid schematic component object." ) );
1295 
1296  undoItem = cmp;
1297  }
1298 
1299  if( item->IsNew() )
1300  {
1301  if( item->Type() == SCH_SHEET_T )
1302  {
1303  // Fix the size and position of the new sheet using the last values set by
1304  // the m_mouseCaptureCallback function.
1305  m_canvas->SetMouseCapture( NULL, NULL );
1306 
1307  if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
1308  {
1309  screen->SetCurItem( NULL );
1310  delete item;
1311 
1312  if( aRedraw )
1313  GetCanvas()->Refresh();
1314 
1315  return;
1316  }
1317 
1318  SetSheetNumberAndCount();
1319  }
1320 
1321  if( undoItem == item )
1322  {
1323  if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
1324  screen->Append( item );
1325 
1326  SetRepeatItem( item );
1327 
1328  SaveCopyInUndoList( undoItem, UR_NEW );
1329  }
1330  else
1331  {
1332  // Here, item is not a basic schematic item, but an item inside
1333  // a parent basic schematic item,
1334  // currently: sheet pin or component field.
1335  // currently, only a sheet pin can be found as new item,
1336  // because new component fields have a specific handling, and do not appears here
1337  SaveCopyInUndoList( undoItem, UR_CHANGED );
1338 
1339  if( item->Type() == SCH_SHEET_PIN_T )
1340  ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
1341  else
1342  wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
1343  item->Type() );
1344  }
1345  }
1346  else
1347  {
1348  SaveUndoItemInUndoList( undoItem );
1349  }
1350 
1351  item->ClearFlags();
1352  screen->SetModify();
1353  screen->SetCurItem( NULL );
1354  m_canvas->SetMouseCapture( NULL, NULL );
1355  m_canvas->EndMouseCapture();
1356 
1357  if( item->IsConnectable() )
1358  screen->TestDanglingEnds();
1359 
1360  if( aRedraw )
1361  GetCanvas()->Refresh();
1362 }
1363 
1364 
1366 {
1367  wxString title;
1368 
1369  if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
1370  {
1371  title.Printf( L"Eeschema \u2014 %s", GetChars( GetScreen()->GetFileName() ) );
1372  }
1373  else
1374  {
1375  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1376  wxFileName fn = fileName;
1377 
1378  title.Printf( L"Eeschema \u2014 %s [%s] \u2014 %s",
1379  GetChars( fn.GetName() ),
1380  GetChars( m_CurrentSheet->PathHumanReadable() ),
1381  GetChars( fn.GetPath() ) );
1382 
1383  if( fn.FileExists() )
1384  {
1385  if( !fn.IsFileWritable() )
1386  title += _( " [Read Only]" );
1387  }
1388  else
1389  title += _( " [no file]" );
1390  }
1391 
1392  SetTitle( title );
1393 }
void OnLoadProject(wxCommandEvent &event)
Definition: schframe.cpp:1022
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:573
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:474
Definition of the SCH_SHEET class for Eeschema.
Class UTF8 is an 8 bit std::string that is assuredly encoded in UTF8, and supplies special conversion...
Definition: utf8.h:53
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
void OnOpenCvpcb(wxCommandEvent &event)
Definition: schframe.cpp:1101
VTBL_ENTRY void ConfigSave(const SEARCH_STACK &aSList, const wxString &aGroupName, const PARAM_CFG_ARRAY &aParams, const wxString &aFileName=wxEmptyString)
Function ConfigSave saves the current "project" parameters into the wxConfigBase* derivative...
Definition: project.cpp:307
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
bool IsModified()
Function IsModified checks the entire hierarchy for any modifications.
KiCad executable names.
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
Part library alias object definition.
SCH_SCREEN * GetNext()
void OnFindItems(wxCommandEvent &event)
Definition: schframe.cpp:916
void OnLoadFile(wxCommandEvent &event)
Definition: schframe.cpp:972
static void LibNamesAndPaths(PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=NULL)
Function LibNamesAndPaths either saves or loads the names of the currently configured part libraries ...
void OnUpdateSaveSheet(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:813
SCH_EDIT_FRAME::OnSelectTool SCH_EDIT_FRAME::OnEditItem SCH_EDIT_FRAME::Process_Special_Functions ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT
Definition: schframe.cpp:311
ID_SCHEMATIC_VERTICAL_TOOLBAR_END
Definition: schframe.cpp:284
void OnUpdateHiddenPins(wxUpdateUIEvent &event)
Definition: schframe.cpp:795
This file is part of the common library TODO brief description.
void OnOpenPcbModuleEditor(wxCommandEvent &event)
Definition: schframe.cpp:1083
void LoadAllLibraries(PROJECT *aProject, bool aShowProgress=true)
Function LoadAllLibraries loads all of the project's libraries into this container, which should be cleared before calling it.
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
bool IsNew() const
Definition: base_struct.h:216
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:761
const wxString PCBNEW_EXE
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
void OnNewProject(wxCommandEvent &event)
Definition: schframe.cpp:988
void OnFindDialogClose(wxFindDialogEvent &event)
Definition: schframe.cpp:954
PROJECT & Prj()
Definition: kicad.cpp:293
int CountSheets()
Function CountSheets calculates the number of sheets found in "this" this number includes the full su...
Definition: sch_sheet.cpp:828
#define KICTL_CREATE
caller thinks requested project files may not exist
Definition: kiway_player.h:131
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
const wxString & GetFileName() const
void OnCloseWindow(wxCloseEvent &Event)
Definition: schframe.cpp:612
void addCurrentItemToList(bool aRedraw=true)
Function addCurrentItemToList adds the item currently being edited to the schematic and adds the chan...
Definition: schframe.cpp:1268
const wxString NetlistFileExtension
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
Definition: schframe.cpp:1365
static const KICAD_T ComponentsOnly[]
A scan list for schematic component items only.
void OnPrint(wxCommandEvent &event)
Show the print dialog.
Definition: schframe.cpp:1212
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
Definition: dialog_bom.cpp:223
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
Definition: id.h:66
void OnRescueProject(wxCommandEvent &event)
Definition: schframe.cpp:1200
VTBL_ENTRY _ELEM * GetElem(ELEM_T aIndex)
Typically wrapped somewhere else in a more meaningful function wrapper.
Definition: project.cpp:196
#define EVT_FIND_DRC_MARKER(id, fn)
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void Format(OUTPUTFORMATTER *aOutputFormatter, int aCtl)
Function Format outputs this s-expression netlist into aOutputFormatter.
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Function PushPreferences Pushes a few preferences from a parent window to a child window...
Definition: draw_frame.cpp:784
PART_LIB * GetLib()
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
bool LoadComponentAndSelectLib(LIB_ALIAS *aLibEntry, PART_LIB *aLibrary)
Function LoadComponentAndSelectLib selects the current active library.
Definition: libedit.cpp:80
void OnUpdateBlockSelected(wxUpdateUIEvent &event)
Definition: schframe.cpp:770
Implementing DIALOG_SCH_FIND_BASE.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:465
Component library viewer main window.
Definition: viewlib_frame.h:49
void OnUpdateHierarchySheet(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:820
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:459
VTBL_ENTRY bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList...
Definition: kiway_player.h:170
void SaveUndoItemInUndoList(SCH_ITEM *aItem)
Function SaveUndoItemInUndoList swaps the cloned item in member variable m_undoItem with aItem and sa...
Definition: schframe.cpp:597
void OnUpdateSave(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:805
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser) EVT_MENU_RANGE(ID_PREFERENCES_HOTKEY_START
VTBL_ENTRY void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:208
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:520
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI(ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected) EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD
virtual wxString GetScreenDesc() const override
Definition: schframe.cpp:526
#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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
double BestZoom() override
Return the zoom level which displays the full page on screen.
Definition: schframe.cpp:706
Class EDA_HOTKEY_CLIENT_DATA provides client data member for hotkeys to include in command events gen...
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:492
FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_TOOL_RANGE(ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar) EVT_MENU(ID_PREFERENCES_HOTKEY_EXPORT_CONFIG
Class LSET is a set of LAYER_IDs.
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, KIWAY_PLAYER *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:302
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
virtual void SwapData(SCH_ITEM *aItem)
Function SwapData swap the internal data structures aItem with the schematic item.
wxFileName m_project_name
/.pro
Definition: project.h:298
void OnUpdatePaste(wxUpdateUIEvent &event)
Definition: schframe.cpp:778
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Subclass of DIALOG_SCH_FIND_BASE, which is generated by wxFormBuilder.
static int Split(wxArrayString *aResult, const wxString aPathString)
Function Split separates aPathString into individual paths.
#define PcbFileExtension
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:565
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:371
Class NETLIST_EXPORTER_KICAD generates the kicad netlist format supported by pcbnew.
ID_PREFERENCES_HOTKEY_END
void Clear()
Function Clear deletes all draw items and clears the project settings.
Definition: sch_screen.cpp:141
The common library.
Helper dialog and control classes.
Sch->PCB forward update.
Definition: mail_type.h:42
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
static void add_search_paths(SEARCH_STACK *aDst, const SEARCH_STACK &aSrc, int aIndex)
Definition: schframe.cpp:71
int InvokeDialogAnnotate(SCH_EDIT_FRAME *aCaller, wxString message)
Create and show DIALOG_ANNOTATE and return whatever DIALOG_ANNOTATE::ShowModal() returns.
const std::string & GetString()
Definition: richio.h:475
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
virtual bool isAutoSaveRequired() const override
Function autoSaveRequired returns true if the schematic has been modified.
Definition: schframe.cpp:1252
Class SCH_SHEET_PATH.
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
Class HTML_MESSAGE_BOX.
const wxString SchematicFileWildcard
void OnUpdatePCB(wxCommandEvent &event)
Definition: schframe.cpp:844
void OnLoadCmpToFootprintLinkFile(wxCommandEvent &event)
Definition: schframe.cpp:981
void OnUpdateBusOrientation(wxUpdateUIEvent &event)
Definition: schframe.cpp:784
Implementing SIM_PLOT_FRAME_BASE.
void OnOpenLibraryEditor(wxCommandEvent &event)
Definition: schframe.cpp:1125
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
void OnCancelCurrentCommand(wxCommandEvent &aEvent)
Definition: schedit.cpp:497
const wxString SchematicFileExtension
void CreateScreens()
Definition: schframe.cpp:534
SCH_EDIT_FRAME::OnSelectTool SCH_EDIT_FRAME::OnEditItem SCH_EDIT_FRAME::Process_Special_Functions SCH_EDIT_FRAME::OnConvertTextType EVT_UPDATE_UI_RANGE(ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END, SCH_EDIT_FRAME::OnUpdateSelectTool) SCH_EDIT_FRAME
Definition: schframe.cpp:326
EVT_MENU_RANGE(ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, SCH_EDIT_FRAME::Process_Config) EVT_TOOL_RANGE(ID_SCHEMATIC_VERTICAL_TOOLBAR_START
bool IsSingle() const
Function IsSingle is this KIFACE_I running under single_top?
Definition: kiface_i.h:113
void OnAnnotate(wxCommandEvent &event)
Definition: schframe.cpp:826
Class PART_LIBS is a collection of PART_LIBs.
eeschema ERC modeless dialog ID
Definition: id.h:271
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
#define GR_DEFAULT_DRAWMODE
Definition: general.h:69
Definition the SCH_COMPONENT class for Eeschema.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:511
int DisplayExitDialog(wxWindow *parent, const wxString &aMessage)
Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save...
Definition: confirm.cpp:58
Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number.
Definition: ki_exception.h:94
The component library editor main window.
Definition: libeditframe.h:51
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
see class PGM_BASE
void OnExit(wxCommandEvent &event)
Definition: schframe.cpp:1206
#define FN_LEN_MAX
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
SCH_EDIT_FRAME::OnSelectTool SCH_EDIT_FRAME::OnEditItem ID_POPUP_GENERAL_END_RANGE
Definition: schframe.cpp:307
void Append(SCH_ITEM *aItem)
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:485
#define max(a, b)
Definition: auxiliary.h:86
wxString QuoteFullPath(wxFileName &fn, wxPathFormat format)
Quote return value of wxFileName::GetFullPath().
Definition: gestfich.cpp:417
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, const std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:387
const wxString LegacyPcbFileExtension
void OnErc(wxCommandEvent &event)
Definition: schframe.cpp:832
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:911
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Definition: wxstruct.h:112
#define GROUP_SCH_EDITOR
Definition: config_params.h:45
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
#define GNL_ALL
void OnOpenPcbnew(wxCommandEvent &event)
Definition: schframe.cpp:1039
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:68
void SetMaxUndoItems(int aMax)
#define NET_PLUGIN_CHANGE
Function InvokeDialogNetList creates and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::Sh...
const LIB_ID & GetLibId() const
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
Function PrintPage plots or prints the current sheet to the clipboard.
Definition: schframe.cpp:1227
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:730
void OnCreateNetlist(wxCommandEvent &event)
Definition: schframe.cpp:896
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool IsAutoSaveRequired()
Function IsAutoSaveRequired checks the entire hierarchy for any modifications that require auto save...
#define DBG(x)
Definition: fctsys.h:33
SCH_SCREEN * GetFirst()
bool cmp(const Point *a, const Point *b)
Definition: shapes.h:227
void OnSimulate(wxCommandEvent &event)
Definition: simulate.cpp:29
void SetUndoItem(const SCH_ITEM *aItem)
Function SetUndoItem clones aItem which can be used to restore the state of the item being edited whe...
Definition: schframe.cpp:579
SCH_EDIT_FRAME::OnSelectTool ID_SCH_EDIT_COMPONENT_FOOTPRINT
Definition: schframe.cpp:297
void SetFileName(const wxString &aFileName)
Definition for part library class.
#define NAMELESS_PROJECT
default name for nameless projects
Definition: common.h:73
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void OnSelectItem(wxCommandEvent &aEvent)
Definition: schframe.cpp:1237
#define AUTOSAVE_PREFIX_FILENAME
a prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash ...
Definition: wxstruct.h:70
void OnCreateBillOfMaterials(wxCommandEvent &event)
Definition: schframe.cpp:910
bool CheckIfOnDrawList(SCH_ITEM *st)
Definition: sch_screen.cpp:187
Message panel definition file.
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
int ExecuteFile(wxWindow *frame, const wxString &ExecFile, const wxString &param, wxProcess *callback)
Function ExecuteFile calls the executable file ExecFile with the command line parameters param...
Definition: gestfich.cpp:208
Class SCH_BASE_FRAME is a shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRA...
#define SCH_EDIT_FRAME_NAME
Definition: schframe.h:112
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
std::string inputLine
problem line of input [say, from a LINE_READER].
Definition: ki_exception.h:103
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
wxDialog * InvokeDialogERC(SCH_EDIT_FRAME *aCaller)
Create the modeless DIALOG_ERC and show it, return something to destroy or close it.
Definition: dialog_erc.cpp:613
void AddPaths(const wxString &aPaths, int aIndex=-1)
Function AddPaths insert or append path(s)
Definition of class LIB_EDIT_FRAME.
Class SCH_SCREENS is a container class that holds multiple SCH_SCREENs in a hierarchy.
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
KIWAY Kiway
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]