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_OPEN_CMP_TABLE, SCH_EDIT_FRAME::OnLaunchBomManager )
271  EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
272  EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
273  EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
275  EVT_TOOL( ID_AUTOPLACE_FIELDS, SCH_EDIT_FRAME::OnAutoplaceFields )
276  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
277  EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
278  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
279  EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
280 
281  // Tools and buttons for vertical toolbar.
283  EVT_TOOL( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnSelectTool )
284  EVT_TOOL( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnSelectTool )
286  SCH_EDIT_FRAME::OnSelectTool )
287 
288 #ifdef KICAD_SPICE
290  EVT_TOOL( ID_SIM_PROBE, SCH_EDIT_FRAME::OnSelectTool )
291  EVT_TOOL( ID_SIM_TUNE, SCH_EDIT_FRAME::OnSelectTool )
292 #endif /* KICAD_SPICE */
293 
297  SCH_EDIT_FRAME::OnRotate )
299  SCH_EDIT_FRAME::OnEditItem )
302  SCH_EDIT_FRAME::Process_Special_Functions )
303 
304  // Tools and buttons options toolbar
305  EVT_TOOL( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnSelectOptionToolbar )
306  EVT_TOOL( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnSelectOptionToolbar )
307 
309  SCH_EDIT_FRAME::Process_Special_Functions )
311  SCH_EDIT_FRAME::OnSelectUnit )
313  SCH_EDIT_FRAME::OnConvertTextType )
314 
315  // Multple item selection context menu commands.
317 
318  /* Handle user interface update events. */
319  EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
320  EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
321  EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
322  EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
323  EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
324  EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
325  EVT_UPDATE_UI( ID_HIGHLIGHT, SCH_EDIT_FRAME::OnUpdateSelectTool )
326  EVT_UPDATE_UI( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnUpdateSelectTool )
327  EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
328  SCH_EDIT_FRAME::OnUpdateSelectTool )
329  EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
330  EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
331  EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
332 
333  /* Search dialog events. */
334  EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
335  EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker )
336  EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem )
337  EVT_FIND_REPLACE( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
338  EVT_FIND_REPLACE_ALL( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
339 
340 END_EVENT_TABLE()
341 
342 
343 SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
344  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
345  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
346  m_item_to_repeat( 0 )
347 {
348  m_showAxis = false; // true to show axis
349  m_showBorderAndTitleBlock = true; // true to show sheet references
350  m_CurrentSheet = new SCH_SHEET_PATH;
351  m_DefaultSchematicFileName = NAMELESS_PROJECT;
352  m_DefaultSchematicFileName += wxT( ".sch" );
353  m_showAllPins = false;
354  m_previewPosition = wxDefaultPosition;
355  m_previewSize = wxDefaultSize;
356  m_printMonochrome = true;
357  m_printSheetReference = true;
358  SetShowPageLimits( true );
359  m_hotkeysDescrList = g_Schematic_Hokeys_Descr;
360  m_dlgFindReplace = NULL;
361  m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
362  m_undoItem = NULL;
363  m_hasAutoSave = true;
364 
365  SetForceHVLines( true );
366  SetSpiceAjustPassiveValues( false );
367 
368  // Give an icon
369  wxIcon icon;
370  icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
371  SetIcon( icon );
372 
373  // Initialize grid id to the default value (50 mils):
374  const int default_grid = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
375  m_LastGridSizeId = default_grid;
376 
377  LoadSettings( config() );
378 
379  CreateScreens();
380 
381  // Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range
382  if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
383  m_LastGridSizeId = default_grid;
384 
385  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
386 
387  if( m_canvas )
388  m_canvas->SetEnableBlockCommands( true );
389 
390  ReCreateMenuBar();
391  ReCreateHToolbar();
392  ReCreateVToolbar();
393  ReCreateOptToolbar();
394 
395  // Initialize common print setup dialog settings.
396  m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
397  m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
398  m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
399  m_pageSetupData.GetPrintData().SetNoCopies( 1 );
400 
401  m_auimgr.SetManagedWindow( this );
402 
403  EDA_PANEINFO horiz;
404  horiz.HorizontalToolbarPane();
405 
406  EDA_PANEINFO vert;
407  vert.VerticalToolbarPane();
408 
409  EDA_PANEINFO mesg;
410  mesg.MessageToolbarPane();
411 
412  if( m_mainToolBar )
413  m_auimgr.AddPane( m_mainToolBar,
414  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
415 
416  if( m_drawToolBar )
417  m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );
418 
419  if( m_optionsToolBar )
420  m_auimgr.AddPane( m_optionsToolBar,
421  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
422 
423  if( m_canvas )
424  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
425 
426  if( m_messagePanel )
427  m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
428  Layer(10) );
429 
430  m_auimgr.Update();
431 
432  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
433  GetScreen()->SetZoom( BestZoom() );
434 
435  Zoom_Automatique( false );
436 
437  // Net list generator
438  DefaultExecFlags();
439 }
440 
441 
443 {
444  delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
445 
446  SetScreen( NULL );
447 
448  delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
449  delete m_undoItem;
450  delete g_RootSheet;
451  delete m_findReplaceData;
452 
453  m_CurrentSheet = NULL;
454  m_undoItem = NULL;
455  g_RootSheet = NULL;
456  m_findReplaceData = NULL;
457 }
458 
459 
461 {
462  // we cannot store a pointer to an item in the display list here since
463  // that item may be deleted, such as part of a line concatonation or other.
464  // So simply always keep a copy of the object which is to be repeated.
465 
466  SCH_ITEM* old = m_item_to_repeat;
467  SCH_ITEM* cur = aItem;
468 
469  if( cur != old )
470  {
471  if( cur )
472  {
473  aItem = (SCH_ITEM*) cur->Clone();
474 
475  // Clone() preserves the flags, we want 'em cleared.
476  aItem->ClearFlags();
477  }
478 
479  m_item_to_repeat = aItem;
480 
481  delete old;
482  }
483 }
484 
485 
487 {
488  SCH_SCREEN* screen;
489  SCH_SCREENS s_list;
490 
491  /* Set the sheet count, and the sheet number (1 for root sheet)
492  */
493  int sheet_count = g_RootSheet->CountSheets();
494  int SheetNumber = 1;
495  wxString current_sheetpath = m_CurrentSheet->Path();
496  SCH_SHEET_LIST sheetList( g_RootSheet );
497 
498  // Examine all sheets path to find the current sheets path,
499  // and count them from root to the current sheet path:
500  for( unsigned i = 0; i < sheetList.size(); i++ )
501  {
502  wxString sheetpath = sheetList[i].Path();
503 
504  if( sheetpath == current_sheetpath ) // Current sheet path found
505  break;
506 
507  SheetNumber++; /* Not found, increment sheet
508  * number before this current
509  * path */
510  }
511 
512  for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
513  {
514  screen->m_NumberOfScreens = sheet_count;
515  }
516 
517  GetScreen()->m_ScreenNumber = SheetNumber;
518 }
519 
520 
522 {
523  return m_CurrentSheet->LastScreen();
524 }
525 
526 
528 {
529  wxString s = m_CurrentSheet->PathHumanReadable();
530 
531  return s;
532 }
533 
534 
536 {
537  if( g_RootSheet == NULL )
538  {
539  g_RootSheet = new SCH_SHEET();
540  }
541 
542  if( g_RootSheet->GetScreen() == NULL )
543  {
544  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
545  screen->SetMaxUndoItems( m_UndoRedoCountMax );
546  g_RootSheet->SetScreen( screen );
547  SetScreen( g_RootSheet->GetScreen() );
548  }
549 
550  g_RootSheet->GetScreen()->SetFileName( m_DefaultSchematicFileName );
551 
552  m_CurrentSheet->clear();
553  m_CurrentSheet->push_back( g_RootSheet );
554 
555  if( GetScreen() == NULL )
556  {
557  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
558  screen->SetMaxUndoItems( m_UndoRedoCountMax );
559  SetScreen( screen );
560  }
561 
562  GetScreen()->SetZoom( 32.0 );
563 }
564 
565 
567 {
568  wxASSERT_MSG( m_CurrentSheet != NULL, wxT( "SCH_EDIT_FRAME m_CurrentSheet member is NULL." ) );
569 
570  return *m_CurrentSheet;
571 }
572 
573 
575 {
576  *m_CurrentSheet = aSheet;
577 }
578 
579 
581 {
582  // if aItem != NULL, delete a previous m_undoItem, if exists
583  // if aItme = NULL, just clear m_undoItem,
584  // because when calling SetUndoItem( NULL ), we only clear m_undoItem,
585  // because the owner of m_undoItem is no more me.
586  if( aItem && m_undoItem )
587  {
588  delete m_undoItem;
589  }
590 
591  m_undoItem = NULL;
592 
593  if( aItem )
594  m_undoItem = (SCH_ITEM*) aItem->Clone();
595 }
596 
597 
599 {
600  wxCHECK_RET( aItem != NULL,
601  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
602  wxCHECK_RET( m_undoItem != NULL,
603  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
604  wxCHECK_RET( aItem->Type() == m_undoItem->Type(),
605  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
606 
607  aItem->SwapData( m_undoItem );
608  SaveCopyInUndoList( aItem, UR_CHANGED );
609  aItem->SwapData( m_undoItem );
610 }
611 
612 
613 void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
614 {
615  if( Kiface().IsSingle() )
616  {
617  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
618  if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
619  return;
620 
621  LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
622  if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
623  return;
624 
625  viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
626  if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer?
627  return;
628  }
629 
630  SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
631 
632  if( simFrame && !simFrame->Close() ) // Can close the simulator?
633  return;
634 
635  SCH_SHEET_LIST sheetList( g_RootSheet );
636 
637  if( sheetList.IsModified() )
638  {
639  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
640  wxString msg = wxString::Format( _(
641  "Save the changes in\n'%s'\nbefore closing?"),
642  GetChars( fileName )
643  );
644 
645  int ii = DisplayExitDialog( this, msg );
646 
647  switch( ii )
648  {
649  case wxID_CANCEL:
650  aEvent.Veto();
651  return;
652 
653  case wxID_NO:
654  break;
655 
656  case wxID_YES:
657  wxCommandEvent tmp( ID_SAVE_PROJECT );
658  OnSaveProject( tmp );
659  break;
660  }
661  }
662 
663  // Close the find dialog and preserve it's setting if it is displayed.
664  if( m_dlgFindReplace )
665  {
666  m_findDialogPosition = m_dlgFindReplace->GetPosition();
667  m_findDialogSize = m_dlgFindReplace->GetSize();
668  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
669  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
670  m_dlgFindReplace->Destroy();
671  m_dlgFindReplace = NULL;
672  }
673 
674  SCH_SCREENS screens;
675  wxFileName fn;
676 
677  for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
678  {
679  fn = Prj().AbsolutePath( screen->GetFileName() );
680 
681  // Auto save file name is the normal file name prepended with AUTOSAVE_PREFIX_FILENAME.
682  fn.SetName( AUTOSAVE_PREFIX_FILENAME + fn.GetName() );
683 
684  if( fn.FileExists() && fn.IsFileWritable() )
685  wxRemoveFile( fn.GetFullPath() );
686  }
687 
688  sheetList.ClearModifyStatus();
689 
690  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
691 
692  if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty() &&
693  g_RootSheet->GetScreen()->GetDrawItems() != NULL )
694  {
695  UpdateFileHistory( fileName );
696  }
697 
699 
700  // all sub sheets are deleted, only the main sheet is usable
701  m_CurrentSheet->clear();
702 
703  Destroy();
704 }
705 
706 
708 {
709  int dx, dy;
710  wxSize size;
711 
712  dx = GetScreen()->GetPageSettings().GetWidthIU();
713  dy = GetScreen()->GetPageSettings().GetHeightIU();
714 
715  size = m_canvas->GetClientSize();
716 
717  // Reserve no margin because best zoom shows the full page
718  // and margins are already included in function that draws the sheet refernces
719  double margin_scale_factor = 1.0;
720  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
721  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
722 
723  double bestzoom = std::max( zx, zy );
724 
725  SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
726 
727  return bestzoom;
728 }
729 
730 
732 {
733  wxFileName fn = GetScreen()->GetFileName();
734 
735  // Name is <root sheet filename>-<sheet path> and has no extension.
736  // However if filename is too long name is <sheet filename>-<sheet number>
737 
738  #define FN_LEN_MAX 80 // A reasonable value for the short filename len
739 
740  wxString filename = fn.GetName();
741  wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
742 
743  // Remove the last '/' of the path human readable
744  // (and for the root sheet, make sheetFullName empty):
745  sheetFullName.RemoveLast();
746 
747  sheetFullName.Trim( true );
748  sheetFullName.Trim( false );
749 
750  // Convert path human readable separator to '-'
751  sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
752 
753  if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
754  filename += sheetFullName;
755  else
756  filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
757 
758  return filename;
759 }
760 
761 
763 {
764  GetScreen()->SetModify();
765  GetScreen()->SetSave();
766 
767  m_foundItems.SetForceSearch();
768 
769  m_canvas->Refresh();
770 }
771 
772 
773 void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
774 {
775  bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE );
776 
777  event.Enable( enable );
778 }
779 
780 
781 void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
782 {
783  event.Enable( m_blockItems.GetCount() > 0 );
784 }
785 
786 
787 void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
788 {
789  wxString tool_tip = GetForceHVLines() ?
790  _( "Draw wires and buses in any direction" ) :
791  _( "Draw horizontal and vertical wires and buses only" );
792 
793  aEvent.Check( GetForceHVLines() );
794  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
795 }
796 
797 
798 void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
799 {
800  wxString tool_tip = m_showAllPins ? _( "Do not show hidden pins" ) :
801  _( "Show hidden pins" );
802 
803  aEvent.Check( m_showAllPins );
804  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
805 }
806 
807 
808 void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
809 {
810  SCH_SHEET_LIST sheetList( g_RootSheet );
811 
812  aEvent.Enable( sheetList.IsModified() );
813 }
814 
815 
816 void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
817 {
818  aEvent.Enable( GetScreen()->IsModify() );
819 
820 }
821 
822 
823 void SCH_EDIT_FRAME::OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent )
824 {
825  aEvent.Enable( m_CurrentSheet->Last() != g_RootSheet );
826 }
827 
828 
829 void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
830 {
831  InvokeDialogAnnotate( this );
832 }
833 
834 
835 void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
836 {
837  // See if it's already open...
838  wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
839 
840  if( erc )
841  // Bring it to the top if already open. Dual monitor users need this.
842  erc->Raise();
843  else
844  InvokeDialogERC( this );
845 }
846 
847 void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
848 {
849  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
850 
851  fn.SetExt( PcbFileExtension );
852 
853  if( Kiface().IsSingle() )
854  {
855  DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is"
856  " opened in stand-alone mode. In order to create/update"
857  " PCBs from schematics, you need to launch Kicad shell"
858  " and create a PCB project." ) );
859  return;
860  }
861  else
862  {
863  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
864 
865  // a pcb frame can be already existing, but not yet used.
866  // this is the case when running the footprint editor, or the footprint viewer first
867  // if the frame is not visible, the board is not yet loaded
868  if( !frame->IsVisible() )
869  {
870  frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
871  frame->Show( true );
872  }
873 
874  // On Windows, Raise() does not bring the window on screen, when iconized
875  if( frame->IsIconized() )
876  frame->Iconize( false );
877 
878  frame->Raise();
879  }
880 
881  // Ensure the schematic is OK for a netlist creation
882  // (especially all components are annotated):
883  bool success = prepareForNetlist();
884 
885  if( !success )
886  return;
887 
888  NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
889  NETLIST_EXPORTER_KICAD exporter( net_atoms, Prj().SchLibs() );
890  STRING_FORMATTER formatter;
891 
892  exporter.Format( &formatter, GNL_ALL );
893 
894  // Now, send the "kicad" (s-expr) netlist to Pcbnew
896  formatter.GetString(), this );
897 }
898 
899 void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
900 {
901  int result;
902 
903  do
904  {
905  result = InvokeDialogNetList( this );
906 
907  // If a plugin is removed or added, rebuild and reopen the new dialog
908 
909  } while( result == NET_PLUGIN_CHANGE );
910 }
911 
912 
914 {
915  InvokeDialogCreateBOM( this );
916 }
917 
918 void SCH_EDIT_FRAME::OnLaunchBomManager( wxCommandEvent& event )
919 {
920  // First ensure that entire schematic is annotated
921  if( !prepareForNetlist() )
922  return;
923 
925 }
926 
927 void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
928 {
929  wxCHECK_RET( m_findReplaceData != NULL,
930  wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
931 
932  if( m_dlgFindReplace )
933  {
934  delete m_dlgFindReplace;
935  m_dlgFindReplace = NULL;
936  }
937 
938  // Verify the find dialog is not drawn off the visible display area in case the
939  // display configuration has changed since the last time the dialog position was
940  // saved.
941  wxRect displayRect = wxDisplay().GetGeometry();
942  wxRect dialogRect = wxRect( m_findDialogPosition, m_findDialogSize );
943 
944  wxPoint position = m_findDialogPosition;
945 
946  if( !displayRect.Contains( dialogRect ) )
947  {
948  position = wxDefaultPosition;
949  }
950 
951  int style = 0;
952 
953  if( aEvent.GetId() == wxID_REPLACE )
954  style = wxFR_REPLACEDIALOG;
955 
956  m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, position, m_findDialogSize,
957  style );
958 
959  m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
960  m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
961  m_dlgFindReplace->Show( true );
962 }
963 
964 
965 void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
966 {
967  // If the user dismissed the dialog with the mouse, this will send the cursor back
968  // to the last item found.
969  OnFindSchematicItem( event );
970 
971  if( m_dlgFindReplace )
972  {
973  m_findDialogPosition = m_dlgFindReplace->GetPosition();
974  m_findDialogSize = m_dlgFindReplace->GetSize();
975  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
976  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
977  m_dlgFindReplace->Destroy();
978  m_dlgFindReplace = NULL;
979  }
980 }
981 
982 
983 void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
984 {
985  wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
986 
987  if( fn.size() )
988  OpenProjectFiles( std::vector<wxString>( 1, fn ) );
989 }
990 
991 
992 void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
993 {
994  LoadCmpToFootprintLinkFile();
995  m_canvas->Refresh();
996 }
997 
998 
999 void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
1000 {
1001 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
1002  wxString pro_dir = m_mruPath;
1003 
1004  wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
1005  wxEmptyString, SchematicFileWildcard,
1006  wxFD_SAVE );
1007 
1008  if( dlg.ShowModal() != wxID_CANCEL )
1009  {
1010  // Enforce the extension, wxFileDialog is inept.
1011  wxFileName create_me = dlg.GetPath();
1012  create_me.SetExt( SchematicFileExtension );
1013 
1014  if( create_me.FileExists() )
1015  {
1016  wxString msg = wxString::Format( _(
1017  "Schematic file '%s' already exists, use Open instead" ),
1018  GetChars( create_me.GetFullName() )
1019  );
1020  DisplayError( this, msg );
1021  return ;
1022  }
1023 
1024  // OpenProjectFiles() requires absolute
1025  wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
1026 
1027  OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1028  m_mruPath = create_me.GetPath();
1029  }
1030 }
1031 
1032 
1033 void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
1034 {
1035 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
1036  wxString pro_dir = m_mruPath;
1037 
1038  wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
1039  wxEmptyString, SchematicFileWildcard,
1040  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1041 
1042  if( dlg.ShowModal() != wxID_CANCEL )
1043  {
1044  OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1045  m_mruPath = Prj().GetProjectPath();
1046  }
1047 }
1048 
1049 
1050 void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
1051 {
1052  wxFileName kicad_board = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1053 
1054  if( kicad_board.IsOk() )
1055  {
1056  kicad_board.SetExt( PcbFileExtension );
1057  wxFileName legacy_board( kicad_board );
1058  legacy_board.SetExt( LegacyPcbFileExtension );
1059  wxFileName& boardfn = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
1060  kicad_board : legacy_board;
1061 
1062  if( Kiface().IsSingle() )
1063  {
1064  wxString filename = QuoteFullPath( boardfn );
1065  ExecuteFile( this, PCBNEW_EXE, filename );
1066  }
1067  else
1068  {
1069  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
1070 
1071  // a pcb frame can be already existing, but not yet used.
1072  // this is the case when running the footprint editor, or the footprint viewer first
1073  // if the frame is not visible, the board is not yet loaded
1074  if( !frame->IsVisible() )
1075  {
1076  frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1077  frame->Show( true );
1078  }
1079 
1080  // On Windows, Raise() does not bring the window on screen, when iconized
1081  if( frame->IsIconized() )
1082  frame->Iconize( false );
1083 
1084  frame->Raise();
1085  }
1086  }
1087  else
1088  {
1089  ExecuteFile( this, PCBNEW_EXE );
1090  }
1091 }
1092 
1093 
1094 void SCH_EDIT_FRAME::OnOpenPcbModuleEditor( wxCommandEvent& event )
1095 {
1096  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1097 
1098  if( fn.IsOk() )
1099  {
1101 
1102  // On Windows, Raise() does not bring the window on screen, when iconized
1103  if( fp_editor->IsIconized() )
1104  fp_editor->Iconize( false );
1105 
1106  fp_editor->Show( true );
1107  fp_editor->Raise();
1108  }
1109 }
1110 
1111 
1112 void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
1113 {
1114  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1115 
1116  fn.SetExt( NetlistFileExtension );
1117 
1118  if( prepareForNetlist() )
1119  {
1120  KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1121 
1122  if( !player )
1123  {
1124  player = Kiway().Player( FRAME_CVPCB, true );
1125  player->Show( true );
1126  // player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1127  }
1128 
1129  sendNetlist();
1130 
1131  player->Raise();
1132  }
1133 }
1134 
1135 
1136 void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
1137 {
1138  SCH_COMPONENT* component = NULL;
1139 
1140  if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
1141  {
1142  // We want to edit a component with Libedit.
1143  // we are here by a hot key, or by a popup menu
1144  SCH_ITEM* item = GetScreen()->GetCurItem();
1145 
1146  if( !item )
1147  {
1148  // If we didn't get here by a hot key, then something has gone wrong.
1149  if( event.GetInt() == 0 )
1150  return;
1151 
1152  EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) event.GetClientObject();
1153 
1154  wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
1155 
1156  // Set the locat filter, according to the edit command
1157  const KICAD_T* filterList = SCH_COLLECTOR::ComponentsOnly;
1158  item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
1159 
1160  // Exit if no item found at the current location or the item is already being edited.
1161  if( (item == NULL) || (item->GetFlags() != 0) )
1162  return;
1163  }
1164 
1165 
1166  if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
1167  {
1168  wxMessageBox( _( "Error: not a component or no component" ) );
1169  return;
1170  }
1171 
1172  component = (SCH_COMPONENT*) item;
1173  }
1174 
1175  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
1176 
1177  if( !libeditFrame )
1178  {
1179  libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
1180  libeditFrame->Show( true );
1181  }
1182 
1183  libeditFrame->PushPreferences( m_canvas );
1184 
1185  // On Windows, Raise() does not bring the window on screen, when iconized
1186  if( libeditFrame->IsIconized() )
1187  libeditFrame->Iconize( false );
1188 
1189  libeditFrame->Raise();
1190 
1191  if( component )
1192  {
1193  if( PART_LIBS* libs = Prj().SchLibs() )
1194  {
1195  LIB_ALIAS* entry = libs->FindLibraryAlias( component->GetLibId() );
1196 
1197  if( !entry ) // Should not occur
1198  return;
1199 
1200  PART_LIB* library = entry->GetLib();
1201 
1202  libeditFrame->LoadComponentAndSelectLib( entry, library );
1203  }
1204  }
1205 
1206  GetScreen()->SchematicCleanUp();
1207  m_canvas->Refresh();
1208 }
1209 
1210 
1211 void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
1212 {
1213  RescueProject( true );
1214 }
1215 
1216 
1217 void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1218 {
1219  Close( false );
1220 }
1221 
1222 
1223 void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
1224 {
1226 
1227  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1228 
1229  if( fn.GetName() != NAMELESS_PROJECT )
1230  {
1231  // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
1232  Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
1233  GetProjectFileParametersList() );
1234  }
1235 }
1236 
1237 
1238 void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
1239  void* aData )
1240 {
1241  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1242 
1243  GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
1244  DrawWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
1245 }
1246 
1247 
1248 void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
1249 {
1250  int id = aEvent.GetId();
1251  int index = id - ID_SELECT_ITEM_START;
1252 
1253  if( (id >= ID_SELECT_ITEM_START && id <= ID_SELECT_ITEM_END)
1254  && (index >= 0 && index < m_collectedItems.GetCount()) )
1255  {
1256  SCH_ITEM* item = m_collectedItems[index];
1257  m_canvas->SetAbortRequest( false );
1258  GetScreen()->SetCurItem( item );
1259  }
1260 }
1261 
1262 
1264 {
1265  // In case this event happens before g_RootSheet is initialized which does happen
1266  // on mingw64 builds.
1267 
1268  if( g_RootSheet != NULL )
1269  {
1270  SCH_SHEET_LIST sheetList( g_RootSheet );
1271 
1272  return sheetList.IsAutoSaveRequired();
1273  }
1274 
1275  return false;
1276 }
1277 
1278 
1280 {
1281  SCH_SCREEN* screen = GetScreen();
1282  SCH_ITEM* item = screen->GetCurItem();
1283 
1284  wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
1285 
1286  m_canvas->SetAutoPanRequest( false );
1287 
1288  SCH_ITEM* undoItem = item;
1289 
1290  if( item->Type() == SCH_SHEET_PIN_T )
1291  {
1292  SCH_SHEET* sheet = (SCH_SHEET*) item->GetParent();
1293 
1294  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
1295  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
1296 
1297  undoItem = sheet;
1298  }
1299 
1300  else if( item->Type() == SCH_FIELD_T )
1301  {
1302  SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
1303 
1304  wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
1305  wxT( "Cannot place field in invalid schematic component object." ) );
1306 
1307  undoItem = cmp;
1308  }
1309 
1310  if( item->IsNew() )
1311  {
1312  if( item->Type() == SCH_SHEET_T )
1313  {
1314  // Fix the size and position of the new sheet using the last values set by
1315  // the m_mouseCaptureCallback function.
1316  m_canvas->SetMouseCapture( NULL, NULL );
1317 
1318  if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
1319  {
1320  screen->SetCurItem( NULL );
1321  delete item;
1322 
1323  if( aRedraw )
1324  GetCanvas()->Refresh();
1325 
1326  return;
1327  }
1328 
1329  SetSheetNumberAndCount();
1330  }
1331 
1332  if( undoItem == item )
1333  {
1334  if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
1335  screen->Append( item );
1336 
1337  SetRepeatItem( item );
1338 
1339  SaveCopyInUndoList( undoItem, UR_NEW );
1340  }
1341  else
1342  {
1343  // Here, item is not a basic schematic item, but an item inside
1344  // a parent basic schematic item,
1345  // currently: sheet pin or component field.
1346  // currently, only a sheet pin can be found as new item,
1347  // because new component fields have a specific handling, and do not appears here
1348  SaveCopyInUndoList( undoItem, UR_CHANGED );
1349 
1350  if( item->Type() == SCH_SHEET_PIN_T )
1351  ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
1352  else
1353  wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
1354  item->Type() );
1355  }
1356  }
1357  else
1358  {
1359  SaveUndoItemInUndoList( undoItem );
1360  }
1361 
1362  item->ClearFlags();
1363  screen->SetModify();
1364  screen->SetCurItem( NULL );
1365  m_canvas->SetMouseCapture( NULL, NULL );
1366  m_canvas->EndMouseCapture();
1367 
1368  if( item->IsConnectable() )
1369  screen->TestDanglingEnds();
1370 
1371  if( aRedraw )
1372  GetCanvas()->Refresh();
1373 }
1374 
1375 
1377 {
1378  wxString title;
1379 
1380  if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
1381  {
1382  title.Printf( L"Eeschema \u2014 %s", GetChars( GetScreen()->GetFileName() ) );
1383  }
1384  else
1385  {
1386  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1387  wxFileName fn = fileName;
1388 
1389  title.Printf( L"Eeschema \u2014 %s [%s] \u2014 %s",
1390  GetChars( fn.GetName() ),
1391  GetChars( m_CurrentSheet->PathHumanReadable() ),
1392  GetChars( fn.GetPath() ) );
1393 
1394  if( fn.FileExists() )
1395  {
1396  if( !fn.IsFileWritable() )
1397  title += _( " [Read Only]" );
1398  }
1399  else
1400  title += _( " [no file]" );
1401  }
1402 
1403  SetTitle( title );
1404 }
void OnLoadProject(wxCommandEvent &event)
Definition: schframe.cpp:1033
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:574
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:475
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:1112
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:927
void OnLoadFile(wxCommandEvent &event)
Definition: schframe.cpp:983
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:816
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:312
ID_SCHEMATIC_VERTICAL_TOOLBAR_END
Definition: schframe.cpp:285
void OnUpdateHiddenPins(wxUpdateUIEvent &event)
Definition: schframe.cpp:798
This file is part of the common library TODO brief description.
void OnOpenPcbModuleEditor(wxCommandEvent &event)
Definition: schframe.cpp:1094
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:762
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:999
void OnFindDialogClose(wxFindDialogEvent &event)
Definition: schframe.cpp:965
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
void OnLaunchBomManager(wxCommandEvent &event)
Definition: schframe.cpp:918
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:613
void addCurrentItemToList(bool aRedraw=true)
Function addCurrentItemToList adds the item currently being edited to the schematic and adds the chan...
Definition: schframe.cpp:1279
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:1376
static const KICAD_T ComponentsOnly[]
A scan list for schematic component items only.
void OnPrint(wxCommandEvent &event)
Show the print dialog.
Definition: schframe.cpp:1223
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:1211
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:806
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:773
Implementing DIALOG_SCH_FIND_BASE.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:466
Component library viewer main window.
Definition: viewlib_frame.h:49
void OnUpdateHierarchySheet(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:823
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:460
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:598
void OnUpdateSave(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:808
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:521
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:527
#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:707
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:493
void InvokeDialogCreateBOMEditor(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM_EDITOR.
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 PCB_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:303
void OnUpdatePaste(wxUpdateUIEvent &event)
Definition: schframe.cpp:781
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:566
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.
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
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:1263
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:847
void OnLoadCmpToFootprintLinkFile(wxCommandEvent &event)
Definition: schframe.cpp:992
void OnUpdateBusOrientation(wxUpdateUIEvent &event)
Definition: schframe.cpp:787
Implementing SIM_PLOT_FRAME_BASE.
void OnOpenLibraryEditor(wxCommandEvent &event)
Definition: schframe.cpp:1136
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:496
const wxString SchematicFileExtension
void CreateScreens()
Definition: schframe.cpp:535
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:327
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:115
void OnAnnotate(wxCommandEvent &event)
Definition: schframe.cpp:829
Class PART_LIBS is a collection of PART_LIBs.
eeschema ERC modeless dialog ID
Definition: id.h:272
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
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:512
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:1217
#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:308
void Append(SCH_ITEM *aItem)
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:486
#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:835
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:113
#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:1050
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
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:1238
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:731
void OnCreateNetlist(wxCommandEvent &event)
Definition: schframe.cpp:899
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:580
SCH_EDIT_FRAME::OnSelectTool ID_SCH_EDIT_COMPONENT_FOOTPRINT
Definition: schframe.cpp:298
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:1248
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
Definition: wxstruct.h:71
void OnCreateBillOfMaterials(wxCommandEvent &event)
Definition: schframe.cpp:913
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[]