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