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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2017 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_DUPLICATE_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  Bind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
442 }
443 
444 
446 {
447  Unbind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
449 
450  delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
451 
452  SetScreen( NULL );
453 
454  delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
455  delete m_undoItem;
456  delete g_RootSheet;
457  delete m_findReplaceData;
458 
459  m_CurrentSheet = NULL;
460  m_undoItem = NULL;
461  g_RootSheet = NULL;
462  m_findReplaceData = NULL;
463 }
464 
465 
467 {
468  // we cannot store a pointer to an item in the display list here since
469  // that item may be deleted, such as part of a line concatonation or other.
470  // So simply always keep a copy of the object which is to be repeated.
471 
472  SCH_ITEM* old = m_item_to_repeat;
473  SCH_ITEM* cur = aItem;
474 
475  if( cur != old )
476  {
477  if( cur )
478  {
479  aItem = (SCH_ITEM*) cur->Clone();
480 
481  // Clone() preserves the flags, we want 'em cleared.
482  aItem->ClearFlags();
483  }
484 
485  m_item_to_repeat = aItem;
486 
487  delete old;
488  }
489 }
490 
491 
493 {
494  SCH_SCREEN* screen;
495  SCH_SCREENS s_list;
496 
497  /* Set the sheet count, and the sheet number (1 for root sheet)
498  */
499  int sheet_count = g_RootSheet->CountSheets();
500  int SheetNumber = 1;
501  wxString current_sheetpath = m_CurrentSheet->Path();
502  SCH_SHEET_LIST sheetList( g_RootSheet );
503 
504  // Examine all sheets path to find the current sheets path,
505  // and count them from root to the current sheet path:
506  for( unsigned i = 0; i < sheetList.size(); i++ )
507  {
508  wxString sheetpath = sheetList[i].Path();
509 
510  if( sheetpath == current_sheetpath ) // Current sheet path found
511  break;
512 
513  SheetNumber++; /* Not found, increment sheet
514  * number before this current
515  * path */
516  }
517 
518  for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
519  {
520  screen->m_NumberOfScreens = sheet_count;
521  }
522 
523  GetScreen()->m_ScreenNumber = SheetNumber;
524 }
525 
526 
528 {
529  return m_CurrentSheet->LastScreen();
530 }
531 
532 
534 {
535  wxString s = m_CurrentSheet->PathHumanReadable();
536 
537  return s;
538 }
539 
540 
542 {
543  if( g_RootSheet == NULL )
544  {
545  g_RootSheet = new SCH_SHEET();
546  }
547 
548  if( g_RootSheet->GetScreen() == NULL )
549  {
550  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
551  screen->SetMaxUndoItems( m_UndoRedoCountMax );
552  g_RootSheet->SetScreen( screen );
553  SetScreen( g_RootSheet->GetScreen() );
554  }
555 
556  g_RootSheet->GetScreen()->SetFileName( m_DefaultSchematicFileName );
557 
558  m_CurrentSheet->clear();
559  m_CurrentSheet->push_back( g_RootSheet );
560 
561  if( GetScreen() == NULL )
562  {
563  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
564  screen->SetMaxUndoItems( m_UndoRedoCountMax );
565  SetScreen( screen );
566  }
567 
568  GetScreen()->SetZoom( 32.0 );
569 }
570 
571 
573 {
574  wxASSERT_MSG( m_CurrentSheet != NULL, wxT( "SCH_EDIT_FRAME m_CurrentSheet member is NULL." ) );
575 
576  return *m_CurrentSheet;
577 }
578 
579 
581 {
582  *m_CurrentSheet = aSheet;
583 }
584 
585 
587 {
588  // if aItem != NULL, delete a previous m_undoItem, if exists
589  // if aItme = NULL, just clear m_undoItem,
590  // because when calling SetUndoItem( NULL ), we only clear m_undoItem,
591  // because the owner of m_undoItem is no more me.
592  if( aItem && m_undoItem )
593  {
594  delete m_undoItem;
595  }
596 
597  m_undoItem = NULL;
598 
599  if( aItem )
600  m_undoItem = (SCH_ITEM*) aItem->Clone();
601 }
602 
603 
605 {
606  wxCHECK_RET( aItem != NULL,
607  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
608  wxCHECK_RET( m_undoItem != NULL,
609  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
610  wxCHECK_RET( aItem->Type() == m_undoItem->Type(),
611  wxT( "Cannot swap undo item structures. Bad programmer!." ) );
612 
613  aItem->SwapData( m_undoItem );
614  SaveCopyInUndoList( aItem, UR_CHANGED );
615  aItem->SwapData( m_undoItem );
616 }
617 
618 
619 void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
620 {
621  if( Kiface().IsSingle() )
622  {
623  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
624  if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
625  return;
626 
627  LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
628  if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
629  return;
630 
631  viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
632  if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer?
633  return;
634  }
635 
636  SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
637 
638  if( simFrame && !simFrame->Close() ) // Can close the simulator?
639  return;
640 
641  SCH_SHEET_LIST sheetList( g_RootSheet );
642 
643  if( sheetList.IsModified() )
644  {
645  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
646  wxString msg = wxString::Format( _(
647  "Save the changes in\n'%s'\nbefore closing?"),
648  GetChars( fileName )
649  );
650 
651  int ii = DisplayExitDialog( this, msg );
652 
653  switch( ii )
654  {
655  case wxID_CANCEL:
656  aEvent.Veto();
657  return;
658 
659  case wxID_NO:
660  break;
661 
662  case wxID_YES:
663  wxCommandEvent tmp( ID_SAVE_PROJECT );
664  OnSaveProject( tmp );
665  break;
666  }
667  }
668 
669  // Close the find dialog and preserve it's setting if it is displayed.
670  if( m_dlgFindReplace )
671  {
672  m_findDialogPosition = m_dlgFindReplace->GetPosition();
673  m_findDialogSize = m_dlgFindReplace->GetSize();
674  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
675  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
676  m_dlgFindReplace->Destroy();
677  m_dlgFindReplace = NULL;
678  }
679 
680  SCH_SCREENS screens;
681  wxFileName fn;
682 
683  for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
684  {
685  fn = Prj().AbsolutePath( screen->GetFileName() );
686 
687  // Auto save file name is the normal file name prepended with AUTOSAVE_PREFIX_FILENAME.
688  fn.SetName( AUTOSAVE_PREFIX_FILENAME + fn.GetName() );
689 
690  if( fn.FileExists() && fn.IsFileWritable() )
691  wxRemoveFile( fn.GetFullPath() );
692  }
693 
694  sheetList.ClearModifyStatus();
695 
696  wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
697 
698  if( !g_RootSheet->GetScreen()->GetFileName().IsEmpty() &&
699  g_RootSheet->GetScreen()->GetDrawItems() != NULL )
700  {
701  UpdateFileHistory( fileName );
702  }
703 
705 
706  // all sub sheets are deleted, only the main sheet is usable
707  m_CurrentSheet->clear();
708 
709  Destroy();
710 }
711 
712 
714 {
715  int dx, dy;
716  wxSize size;
717 
718  dx = GetScreen()->GetPageSettings().GetWidthIU();
719  dy = GetScreen()->GetPageSettings().GetHeightIU();
720 
721  size = m_canvas->GetClientSize();
722 
723  // Reserve no margin because best zoom shows the full page
724  // and margins are already included in function that draws the sheet refernces
725  double margin_scale_factor = 1.0;
726  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
727  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
728 
729  double bestzoom = std::max( zx, zy );
730 
731  SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
732 
733  return bestzoom;
734 }
735 
736 
738 {
739  wxFileName fn = GetScreen()->GetFileName();
740 
741  // Name is <root sheet filename>-<sheet path> and has no extension.
742  // However if filename is too long name is <sheet filename>-<sheet number>
743 
744  #define FN_LEN_MAX 80 // A reasonable value for the short filename len
745 
746  wxString filename = fn.GetName();
747  wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
748 
749  // Remove the last '/' of the path human readable
750  // (and for the root sheet, make sheetFullName empty):
751  sheetFullName.RemoveLast();
752 
753  sheetFullName.Trim( true );
754  sheetFullName.Trim( false );
755 
756  // Convert path human readable separator to '-'
757  sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
758 
759  if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
760  filename += sheetFullName;
761  else
762  filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
763 
764  return filename;
765 }
766 
767 
769 {
770  GetScreen()->SetModify();
771  GetScreen()->SetSave();
772 
773  m_foundItems.SetForceSearch();
774 
775  m_canvas->Refresh();
776 }
777 
778 
779 void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
780 {
781  bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE );
782 
783  event.Enable( enable );
784 }
785 
786 
787 void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
788 {
789  event.Enable( m_blockItems.GetCount() > 0 );
790 }
791 
792 
793 void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
794 {
795  wxString tool_tip = GetForceHVLines() ?
796  _( "Draw wires and buses in any direction" ) :
797  _( "Draw horizontal and vertical wires and buses only" );
798 
799  aEvent.Check( GetForceHVLines() );
800  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
801 }
802 
803 
804 void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
805 {
806  wxString tool_tip = m_showAllPins ? _( "Do not show hidden pins" ) :
807  _( "Show hidden pins" );
808 
809  aEvent.Check( m_showAllPins );
810  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
811 }
812 
813 
814 void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
815 {
816  SCH_SHEET_LIST sheetList( g_RootSheet );
817 
818  aEvent.Enable( sheetList.IsModified() );
819 }
820 
821 
822 void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
823 {
824  aEvent.Enable( GetScreen()->IsModify() );
825 
826 }
827 
828 
829 void SCH_EDIT_FRAME::OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent )
830 {
831  aEvent.Enable( m_CurrentSheet->Last() != g_RootSheet );
832 }
833 
834 
835 void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
836 {
837  InvokeDialogAnnotate( this );
838 }
839 
840 
841 void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
842 {
843  // See if it's already open...
844  wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
845 
846  if( erc )
847  // Bring it to the top if already open. Dual monitor users need this.
848  erc->Raise();
849  else
850  InvokeDialogERC( this );
851 }
852 
853 void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
854 {
855  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
856 
857  fn.SetExt( PcbFileExtension );
858 
859  if( Kiface().IsSingle() )
860  {
861  DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is"
862  " opened in stand-alone mode. In order to create/update"
863  " PCBs from schematics, you need to launch Kicad shell"
864  " and create a PCB project." ) );
865  return;
866  }
867  else
868  {
869  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
870 
871  // a pcb frame can be already existing, but not yet used.
872  // this is the case when running the footprint editor, or the footprint viewer first
873  // if the frame is not visible, the board is not yet loaded
874  if( !frame->IsVisible() )
875  {
876  frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
877  frame->Show( true );
878  }
879 
880  // On Windows, Raise() does not bring the window on screen, when iconized
881  if( frame->IsIconized() )
882  frame->Iconize( false );
883 
884  frame->Raise();
885  }
886 
887  // Ensure the schematic is OK for a netlist creation
888  // (especially all components are annotated):
889  bool success = prepareForNetlist();
890 
891  if( !success )
892  return;
893 
894  NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
895  NETLIST_EXPORTER_KICAD exporter( net_atoms, Prj().SchLibs() );
896  STRING_FORMATTER formatter;
897 
898  exporter.Format( &formatter, GNL_ALL );
899 
900  // Now, send the "kicad" (s-expr) netlist to Pcbnew
902  formatter.GetString(), this );
903 }
904 
905 void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
906 {
907  int result;
908 
909  do
910  {
911  result = InvokeDialogNetList( this );
912 
913  // If a plugin is removed or added, rebuild and reopen the new dialog
914 
915  } while( result == NET_PLUGIN_CHANGE );
916 }
917 
918 
920 {
921  InvokeDialogCreateBOM( this );
922 }
923 
924 void SCH_EDIT_FRAME::OnLaunchBomManager( wxCommandEvent& event )
925 {
926  // First ensure that entire schematic is annotated
927  if( !prepareForNetlist() )
928  return;
929 
931 }
932 
933 void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
934 {
935  wxCHECK_RET( m_findReplaceData != NULL,
936  wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
937 
938  if( m_dlgFindReplace )
939  {
940  delete m_dlgFindReplace;
941  m_dlgFindReplace = NULL;
942  }
943 
944  // Verify the find dialog is not drawn off the visible display area in case the
945  // display configuration has changed since the last time the dialog position was
946  // saved.
947  wxRect displayRect = wxDisplay().GetGeometry();
948  wxRect dialogRect = wxRect( m_findDialogPosition, m_findDialogSize );
949 
950  wxPoint position = m_findDialogPosition;
951 
952  if( !displayRect.Contains( dialogRect ) )
953  {
954  position = wxDefaultPosition;
955  }
956 
957  int style = 0;
958 
959  if( aEvent.GetId() == wxID_REPLACE )
960  style = wxFR_REPLACEDIALOG;
961 
962  m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, position, m_findDialogSize,
963  style );
964 
965  m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
966  m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
967  m_dlgFindReplace->Show( true );
968 }
969 
970 
971 void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
972 {
973  // If the user dismissed the dialog with the mouse, this will send the cursor back
974  // to the last item found.
975  OnFindSchematicItem( event );
976 
977  if( m_dlgFindReplace )
978  {
979  m_findDialogPosition = m_dlgFindReplace->GetPosition();
980  m_findDialogSize = m_dlgFindReplace->GetSize();
981  m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
982  m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
983  m_dlgFindReplace->Destroy();
984  m_dlgFindReplace = NULL;
985  }
986 }
987 
988 
989 void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
990 {
991  wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
992 
993  if( fn.size() )
994  OpenProjectFiles( std::vector<wxString>( 1, fn ) );
995 }
996 
997 
998 void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
999 {
1000  LoadCmpToFootprintLinkFile();
1001  m_canvas->Refresh();
1002 }
1003 
1004 
1005 void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
1006 {
1007 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
1008  wxString pro_dir = m_mruPath;
1009 
1010  wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
1011  wxEmptyString, SchematicFileWildcard,
1012  wxFD_SAVE );
1013 
1014  if( dlg.ShowModal() != wxID_CANCEL )
1015  {
1016  // Enforce the extension, wxFileDialog is inept.
1017  wxFileName create_me = dlg.GetPath();
1018  create_me.SetExt( SchematicFileExtension );
1019 
1020  if( create_me.FileExists() )
1021  {
1022  wxString msg = wxString::Format( _(
1023  "Schematic file '%s' already exists, use Open instead" ),
1024  GetChars( create_me.GetFullName() )
1025  );
1026  DisplayError( this, msg );
1027  return ;
1028  }
1029 
1030  // OpenProjectFiles() requires absolute
1031  wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
1032 
1033  OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1034  m_mruPath = create_me.GetPath();
1035  }
1036 }
1037 
1038 
1039 void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
1040 {
1041 // wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
1042  wxString pro_dir = m_mruPath;
1043 
1044  wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
1045  wxEmptyString, SchematicFileWildcard,
1046  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1047 
1048  if( dlg.ShowModal() != wxID_CANCEL )
1049  {
1050  OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1051  m_mruPath = Prj().GetProjectPath();
1052  }
1053 }
1054 
1055 
1056 void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
1057 {
1058  wxFileName kicad_board = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1059 
1060  if( kicad_board.IsOk() )
1061  {
1062  kicad_board.SetExt( PcbFileExtension );
1063  wxFileName legacy_board( kicad_board );
1064  legacy_board.SetExt( LegacyPcbFileExtension );
1065  wxFileName& boardfn = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
1066  kicad_board : legacy_board;
1067 
1068  if( Kiface().IsSingle() )
1069  {
1070  wxString filename = QuoteFullPath( boardfn );
1071  ExecuteFile( this, PCBNEW_EXE, filename );
1072  }
1073  else
1074  {
1075  KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
1076 
1077  // a pcb frame can be already existing, but not yet used.
1078  // this is the case when running the footprint editor, or the footprint viewer first
1079  // if the frame is not visible, the board is not yet loaded
1080  if( !frame->IsVisible() )
1081  {
1082  frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1083  frame->Show( true );
1084  }
1085 
1086  // On Windows, Raise() does not bring the window on screen, when iconized
1087  if( frame->IsIconized() )
1088  frame->Iconize( false );
1089 
1090  frame->Raise();
1091  }
1092  }
1093  else
1094  {
1095  ExecuteFile( this, PCBNEW_EXE );
1096  }
1097 }
1098 
1099 
1100 void SCH_EDIT_FRAME::OnOpenPcbModuleEditor( wxCommandEvent& event )
1101 {
1102  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1103 
1104  if( fn.IsOk() )
1105  {
1107 
1108  // On Windows, Raise() does not bring the window on screen, when iconized
1109  if( fp_editor->IsIconized() )
1110  fp_editor->Iconize( false );
1111 
1112  fp_editor->Show( true );
1113  fp_editor->Raise();
1114  }
1115 }
1116 
1117 
1118 void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
1119 {
1120  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1121 
1122  fn.SetExt( NetlistFileExtension );
1123 
1124  if( prepareForNetlist() )
1125  {
1126  KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1127 
1128  if( !player )
1129  {
1130  player = Kiway().Player( FRAME_CVPCB, true );
1131  player->Show( true );
1132  // player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1133  }
1134 
1135  sendNetlist();
1136 
1137  player->Raise();
1138  }
1139 }
1140 
1141 
1142 void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
1143 {
1144  SCH_COMPONENT* component = NULL;
1145 
1146  if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
1147  {
1148  // We want to edit a component with Libedit.
1149  // we are here by a hot key, or by a popup menu
1150  SCH_ITEM* item = GetScreen()->GetCurItem();
1151 
1152  if( !item )
1153  {
1154  // If we didn't get here by a hot key, then something has gone wrong.
1155  if( event.GetInt() == 0 )
1156  return;
1157 
1158  EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) event.GetClientObject();
1159 
1160  wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
1161 
1162  // Set the locat filter, according to the edit command
1163  const KICAD_T* filterList = SCH_COLLECTOR::ComponentsOnly;
1164  item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
1165 
1166  // Exit if no item found at the current location or the item is already being edited.
1167  if( (item == NULL) || (item->GetFlags() != 0) )
1168  return;
1169  }
1170 
1171 
1172  if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
1173  {
1174  wxMessageBox( _( "Error: not a component or no component" ) );
1175  return;
1176  }
1177 
1178  component = (SCH_COMPONENT*) item;
1179  }
1180 
1181  LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
1182 
1183  if( !libeditFrame )
1184  {
1185  libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
1186  libeditFrame->Show( true );
1187  }
1188 
1189  libeditFrame->PushPreferences( m_canvas );
1190 
1191  // On Windows, Raise() does not bring the window on screen, when iconized
1192  if( libeditFrame->IsIconized() )
1193  libeditFrame->Iconize( false );
1194 
1195  libeditFrame->Raise();
1196 
1197  if( component )
1198  {
1199  if( PART_LIBS* libs = Prj().SchLibs() )
1200  {
1201  LIB_ALIAS* entry = libs->FindLibraryAlias( component->GetLibId() );
1202 
1203  if( !entry ) // Should not occur
1204  return;
1205 
1206  PART_LIB* library = entry->GetLib();
1207 
1208  libeditFrame->LoadComponentAndSelectLib( entry, library );
1209  }
1210  }
1211 
1212  GetScreen()->SchematicCleanUp();
1213  m_canvas->Refresh();
1214 }
1215 
1216 
1217 void SCH_EDIT_FRAME::OnRescueProject( wxCommandEvent& event )
1218 {
1219  RescueProject( true );
1220 }
1221 
1222 
1223 void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1224 {
1225  Close( false );
1226 }
1227 
1228 
1229 void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
1230 {
1232 
1233  wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
1234 
1235  if( fn.GetName() != NAMELESS_PROJECT )
1236  {
1237  // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
1238  Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
1239  GetProjectFileParametersList() );
1240  }
1241 }
1242 
1243 
1244 void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
1245  void* aData )
1246 {
1247  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1248 
1249  GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
1250  DrawWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
1251 }
1252 
1253 
1254 void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
1255 {
1256  int id = aEvent.GetId();
1257  int index = id - ID_SELECT_ITEM_START;
1258 
1259  if( (id >= ID_SELECT_ITEM_START && id <= ID_SELECT_ITEM_END)
1260  && (index >= 0 && index < m_collectedItems.GetCount()) )
1261  {
1262  SCH_ITEM* item = m_collectedItems[index];
1263  m_canvas->SetAbortRequest( false );
1264  GetScreen()->SetCurItem( item );
1265  }
1266 }
1267 
1268 
1270 {
1271  // In case this event happens before g_RootSheet is initialized which does happen
1272  // on mingw64 builds.
1273 
1274  if( g_RootSheet != NULL )
1275  {
1276  SCH_SCREENS screenList;
1277 
1278  for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
1279  {
1280  if( screen->IsSave() )
1281  return true;
1282  }
1283  }
1284 
1285  return false;
1286 }
1287 
1288 
1290 {
1291  SCH_SCREEN* screen = GetScreen();
1292  SCH_ITEM* item = screen->GetCurItem();
1293 
1294  wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
1295 
1296  m_canvas->SetAutoPanRequest( false );
1297 
1298  SCH_ITEM* undoItem = item;
1299 
1300  if( item->Type() == SCH_SHEET_PIN_T )
1301  {
1302  SCH_SHEET* sheet = (SCH_SHEET*) item->GetParent();
1303 
1304  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
1305  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
1306 
1307  undoItem = sheet;
1308  }
1309 
1310  else if( item->Type() == SCH_FIELD_T )
1311  {
1312  SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
1313 
1314  wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
1315  wxT( "Cannot place field in invalid schematic component object." ) );
1316 
1317  undoItem = cmp;
1318  }
1319 
1320  if( item->IsNew() )
1321  {
1322  if( item->Type() == SCH_SHEET_T )
1323  {
1324  // Fix the size and position of the new sheet using the last values set by
1325  // the m_mouseCaptureCallback function.
1326  m_canvas->SetMouseCapture( NULL, NULL );
1327 
1328  if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
1329  {
1330  screen->SetCurItem( NULL );
1331  delete item;
1332 
1333  if( aRedraw )
1334  GetCanvas()->Refresh();
1335 
1336  return;
1337  }
1338 
1339  SetSheetNumberAndCount();
1340  }
1341 
1342  if( undoItem == item )
1343  {
1344  if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
1345  screen->Append( item );
1346 
1347  SetRepeatItem( item );
1348 
1349  SaveCopyInUndoList( undoItem, UR_NEW );
1350  }
1351  else
1352  {
1353  // Here, item is not a basic schematic item, but an item inside
1354  // a parent basic schematic item,
1355  // currently: sheet pin or component field.
1356  // currently, only a sheet pin can be found as new item,
1357  // because new component fields have a specific handling, and do not appears here
1358  SaveCopyInUndoList( undoItem, UR_CHANGED );
1359 
1360  if( item->Type() == SCH_SHEET_PIN_T )
1361  ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
1362  else
1363  wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
1364  item->Type() );
1365  }
1366  }
1367  else
1368  {
1369  SaveUndoItemInUndoList( undoItem );
1370  }
1371 
1372  item->ClearFlags();
1373  screen->SetModify();
1374  screen->SetCurItem( NULL );
1375  m_canvas->SetMouseCapture( NULL, NULL );
1376  m_canvas->EndMouseCapture();
1377 
1378  if( item->IsConnectable() )
1379  screen->TestDanglingEnds();
1380 
1381  if( aRedraw )
1382  GetCanvas()->Refresh();
1383 }
1384 
1385 
1387 {
1388  wxString title;
1389 
1390  if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
1391  {
1392  title.Printf( L"Eeschema \u2014 %s", GetChars( GetScreen()->GetFileName() ) );
1393  }
1394  else
1395  {
1396  wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1397  wxFileName fn = fileName;
1398 
1399  title.Printf( L"Eeschema \u2014 %s [%s] \u2014 %s",
1400  GetChars( fn.GetName() ),
1401  GetChars( m_CurrentSheet->PathHumanReadable() ),
1402  GetChars( fn.GetPath() ) );
1403 
1404  if( fn.FileExists() )
1405  {
1406  if( !fn.IsFileWritable() )
1407  title += _( " [Read Only]" );
1408  }
1409  else
1410  title += _( " [no file]" );
1411  }
1412 
1413  SetTitle( title );
1414 }
void OnLoadProject(wxCommandEvent &event)
Definition: schframe.cpp:1039
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:580
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 string that is assuredly encoded in UTF8, and supplies special conversion supp...
Definition: utf8.h:73
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:1118
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:933
void OnLoadFile(wxCommandEvent &event)
Definition: schframe.cpp:989
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:822
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 OnEditSymbolLibTable(wxCommandEvent &aEvent)
void OnUpdateHiddenPins(wxUpdateUIEvent &event)
Definition: schframe.cpp:804
This file is part of the common library TODO brief description.
void OnOpenPcbModuleEditor(wxCommandEvent &event)
Definition: schframe.cpp:1100
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:768
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:1005
void OnFindDialogClose(wxFindDialogEvent &event)
Definition: schframe.cpp:971
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:924
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:619
void addCurrentItemToList(bool aRedraw=true)
Function addCurrentItemToList adds the item currently being edited to the schematic and adds the chan...
Definition: schframe.cpp:1289
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:1386
static const KICAD_T ComponentsOnly[]
A scan list for schematic component items only.
void OnPrint(wxCommandEvent &event)
Show the print dialog.
Definition: schframe.cpp:1229
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:1217
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:779
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:829
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:466
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:604
void OnUpdateSave(wxUpdateUIEvent &aEvent)
Definition: schframe.cpp:814
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:527
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:533
#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:713
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:55
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:307
void OnUpdatePaste(wxUpdateUIEvent &event)
Definition: schframe.cpp:787
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:572
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:1269
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:853
void OnLoadCmpToFootprintLinkFile(wxCommandEvent &event)
Definition: schframe.cpp:998
void OnUpdateBusOrientation(wxUpdateUIEvent &event)
Definition: schframe.cpp:793
Implementing SIM_PLOT_FRAME_BASE.
void OnOpenLibraryEditor(wxCommandEvent &event)
Definition: schframe.cpp:1142
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:541
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:835
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:59
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:1223
#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:492
#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:841
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:915
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:1056
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:1244
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:737
void OnCreateNetlist(wxCommandEvent &event)
Definition: schframe.cpp:905
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
#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:586
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:1254
#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:919
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:71
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[]