KiCad PCB EDA Suite
lib_edit_frame.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <base_screen.h>
27 #include <class_library.h>
28 #include <confirm.h>
29 #include <eeschema_id.h>
30 #include <eeschema_settings.h>
31 #include <fctsys.h>
32 #include <general.h>
33 #include <kiface_i.h>
34 #include <kiway_express.h>
35 #include <lib_edit_frame.h>
36 #include <lib_manager.h>
37 #include <libedit_settings.h>
38 #include <pgm_base.h>
39 #include <sch_draw_panel.h>
40 #include <sch_painter.h>
41 #include <sch_view.h>
43 #include <symbol_lib_table.h>
44 #include <tool/action_toolbar.h>
45 #include <tool/common_control.h>
46 #include <tool/common_tools.h>
47 #include <tool/picker_tool.h>
48 #include <tool/tool_dispatcher.h>
49 #include <tool/tool_manager.h>
50 #include <tool/zoom_tool.h>
51 #include <tools/ee_actions.h>
53 #include <tools/ee_point_editor.h>
55 #include <tools/lib_control.h>
57 #include <tools/lib_edit_tool.h>
58 #include <tools/lib_move_tool.h>
59 #include <tools/lib_pin_tool.h>
60 #include <widgets/lib_tree.h>
63 #include <wx/progdlg.h>
64 
65 
66 bool LIB_EDIT_FRAME:: m_showDeMorgan = false;
67 int LIB_EDIT_FRAME:: g_LastTextSize = -1;
68 double LIB_EDIT_FRAME:: g_LastTextAngle = TEXT_ANGLE_HORIZ;
69 int LIB_EDIT_FRAME:: g_LastLineWidth = 0;
70 
71 // these values are overridden when reading the config
72 int LIB_EDIT_FRAME:: m_textPinNumDefaultSize = Mils2iu( DEFAULTPINNUMSIZE );
73 int LIB_EDIT_FRAME:: m_textPinNameDefaultSize = Mils2iu( DEFAULTPINNAMESIZE );
74 int LIB_EDIT_FRAME:: m_defaultPinLength = Mils2iu( DEFAULTPINLENGTH );
75 
76 FILL_T LIB_EDIT_FRAME:: g_LastFillStyle = NO_FILL;
77 
78 
79 BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
81  EVT_SIZE( LIB_EDIT_FRAME::OnSize )
82 
84 
85  // Right vertical toolbar.
88 
89  // menubar commands
90  EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::OnExitKiCad )
91  EVT_MENU( wxID_CLOSE, LIB_EDIT_FRAME::CloseWindow )
93 
94  // Update user interface elements.
96 
97 END_EVENT_TABLE()
98 
99 LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
100  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
101  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
102 {
103  SetShowDeMorgan( false );
104  m_DrawSpecificConvert = true;
105  m_DrawSpecificUnit = false;
106  m_SyncPinEdit = false;
107  m_repeatPinStep = Mils2iu( DEFAULT_REPEAT_OFFSET_PIN );
108  SetShowElectricalType( true );
109  m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
110 
111  m_my_part = nullptr;
112  m_treePane = nullptr;
113  m_libMgr = nullptr;
114  m_unit = 1;
115  m_convert = 1;
116  m_AboutTitle = "LibEdit";
117 
118  // Delayed initialization
119  if( g_LastTextSize == -1 )
120  g_LastTextSize = GetDefaultTextSize();
121 
122  // Initialize grid id to the default value 50 mils:
124 
125  wxIcon icon;
126  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
127  SetIcon( icon );
128 
129  m_settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
130  LoadSettings( m_settings );
131 
132  // Ensure axis are always drawn
133  KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
134  gal_opts.m_axesEnabled = true;
135 
136  m_dummyScreen = new SCH_SCREEN( aKiway );
137  SetScreen( m_dummyScreen );
138  GetScreen()->m_Center = true;
139  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
140 
141  GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
142  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
143 
144  auto settings = GetCanvas()->GetView()->GetPainter()->GetSettings();
145  settings->LoadColors( GetColorSettings() );
146 
147  setupTools();
148 
149  m_libMgr = new LIB_MANAGER( *this );
150  SyncLibraries( true );
151  m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
152 
153  ReCreateMenuBar();
154  ReCreateHToolbar();
155  ReCreateVToolbar();
156  ReCreateOptToolbar();
157  InitExitKey();
158 
159  updateTitle();
160  DisplayCmpDoc();
161  RebuildSymbolUnitsList();
162 
163  m_auimgr.SetManagedWindow( this );
164 
165  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
166  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
167 
168  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
169  m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1)
170  .Caption( _( "Libraries" ) ).MinSize( 250, -1 )
171  .BestSize( m_defaultLibWidth, -1 ).Resizable() );
172  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
173 
174  m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
175 
176  m_auimgr.Update();
177 
178  GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
179 
180  Raise();
181  Show( true );
182 
183  SyncView();
184  GetCanvas()->GetViewControls()->SetSnapping( true );
185  GetCanvas()->GetView()->UseDrawPriority( true );
186  GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
187  GetCanvas()->GetGAL()->SetAxesEnabled( true );
188 
189  // Set the working/draw area size to display a symbol to a reasonable value:
190  // A 600mm x 600mm with a origin at the area center looks like a large working area
191  double max_size_x = Millimeter2iu( 600 );
192  double max_size_y = Millimeter2iu( 600 );
193  BOX2D bbox;
194  bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
195  bbox.SetSize( max_size_x, max_size_y );
196  GetCanvas()->GetView()->SetBoundary( bbox );
197 
198  m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
199 
200  SetShutdownBlockReason( _( "Library changes are unsaved" ) );
201 }
202 
203 
205 {
206  // Shutdown all running tools
207  if( m_toolManager )
209 
210  // current screen is destroyed in EDA_DRAW_FRAME
212 
213  auto libedit = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
214  Pgm().GetSettingsManager().Save( libedit );
215 
216  delete m_libMgr;
217 }
218 
219 
221 {
223 
224  auto cfg = dynamic_cast<LIBEDIT_SETTINGS*>( aCfg );
225  wxASSERT( cfg );
226 
227  SetDefaultLineThickness( Mils2iu( cfg->m_Defaults.line_width ) );
228  SetDefaultPinLength( Mils2iu( cfg->m_Defaults.pin_length ) );
229  m_textPinNameDefaultSize = Mils2iu( cfg->m_Defaults.pin_name_size );
230  m_textPinNumDefaultSize = Mils2iu( cfg->m_Defaults.pin_num_size );
231  SetRepeatDeltaLabel( cfg->m_Repeat.label_delta );
232  SetRepeatPinStep( Mils2iu( cfg->m_Repeat.pin_step ) );
233  SetRepeatStep( wxPoint( cfg->m_Repeat.x_step, cfg->m_Repeat.y_step ) );
234  m_showPinElectricalTypeName = cfg->m_ShowPinElectricalType;
235  m_defaultLibWidth = cfg->m_LibWidth;
236 
237  // TODO(JE) does libedit need its own TemplateFieldNames?
238  auto ee_settings = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
239  wxASSERT( ee_settings );
240  wxString templateFieldNames = ee_settings->m_Drawing.field_names;
241 
242  if( !templateFieldNames.IsEmpty() )
243  {
244  TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
245 
246  try
247  {
248  m_templateFieldNames.Parse( &lexer, true );
249  }
250  catch( const IO_ERROR& DBG( e ) )
251  {
252  // @todo show error msg
253  DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
254  }
255  }
256 
257  auto painter = static_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
258  KIGFX::SCH_RENDER_SETTINGS* settings = painter->GetSettings();
260 
261  // Hidden elements must be editable
262  settings->m_ShowHiddenText = true;
263  settings->m_ShowHiddenPins = true;
264  settings->m_ShowUmbilicals = false;
265 }
266 
267 
269 {
270  // aCfg will be EESCHEMA_SETTINGS because that's the parent FACE
271  // so we throw it away here and get our own settings
272 
273  auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
275 
276  cfg->m_Defaults.line_width = Iu2Mils( GetDefaultLineThickness() );
277  cfg->m_Defaults.pin_length = Iu2Mils( GetDefaultPinLength() );
278  cfg->m_Defaults.pin_name_size = Iu2Mils( GetPinNameDefaultSize() );
279  cfg->m_Defaults.pin_num_size = Iu2Mils( GetPinNumDefaultSize() );
280  cfg->m_Repeat.label_delta = GetRepeatDeltaLabel();
281  cfg->m_Repeat.pin_step = Iu2Mils( GetRepeatPinStep() );
282  cfg->m_Repeat.x_step = Iu2Mils( GetRepeatStep().x );
283  cfg->m_Repeat.y_step = Iu2Mils( GetRepeatStep().y );
284  cfg->m_ShowPinElectricalType = GetShowElectricalType();
285  cfg->m_LibWidth = m_treePane->GetSize().x;
286 }
287 
288 
290 {
291  auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
292 
293  if( cfg->m_UseEeschemaColorSettings )
294  return m_colorSettings;
295  else
296  return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
297 }
298 
299 
301 {
302  // Create the manager and dispatcher & route draw panel events to the dispatcher
305  GetCanvas()->GetViewControls(), this );
306  m_actions = new EE_ACTIONS();
308 
309  // Register tools
323 
324  // Run the selection tool, it is supposed to be always active
325  m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
326 
328 }
329 
330 
331 void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
332 {
333  // Shutdown blocks must be determined and vetoed as early as possible
334  if( SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
335  && IsContentModified() )
336  {
337  aEvent.Veto();
338  return;
339  }
340 
341  if( saveAllLibraries( true ) )
342  Destroy();
343  else
344  aEvent.Veto();
345 }
346 
347 
349 {
350  if( !m_unitSelectBox )
351  return;
352 
353  if( m_unitSelectBox->GetCount() != 0 )
354  m_unitSelectBox->Clear();
355 
356  if( !m_my_part || m_my_part->GetUnitCount() <= 1 )
357  {
358  m_unit = 1;
359  m_unitSelectBox->Append( wxEmptyString );
360  }
361  else
362  {
363  for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
364  {
365  wxString sub = LIB_PART::SubReference( i+1, false );
366  wxString unit = wxString::Format( _( "Unit %s" ), GetChars( sub ) );
367  m_unitSelectBox->Append( unit );
368  }
369  }
370 
371  // Ensure the selected unit is compatible with the number of units of the current part:
372  if( m_my_part && m_my_part->GetUnitCount() < m_unit )
373  m_unit = 1;
374 
375  m_unitSelectBox->SetSelection(( m_unit > 0 ) ? m_unit - 1 : 0 );
376 }
377 
378 
379 void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
380 {
381  auto& treePane = m_auimgr.GetPane( m_treePane );
382  treePane.Show( !IsSearchTreeShown() );
383  m_auimgr.Update();
384 }
385 
386 
388 {
389  return m_auimgr.GetPane( m_treePane ).IsShown();
390 }
391 
392 
394 {
395  m_libMgr->GetAdapter()->Freeze();
396 }
397 
398 
400 {
401  m_libMgr->GetAdapter()->Thaw();
402 }
403 
404 
405 void LIB_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
406 {
407  Kiway().OnKiCadExit();
408 }
409 
410 
411 void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
412 {
413  if( !m_unitSelectBox )
414  return;
415 
416  // Using the typical event.Enable() call doesn't seem to work with wxGTK
417  // so use the pointer to alias combobox to directly enable or disable.
418  m_unitSelectBox->Enable( m_my_part && m_my_part->GetUnitCount() > 1 );
419 }
420 
421 
422 void LIB_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
423 {
424  int i = event.GetSelection();
425 
426  if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) == m_unit ) )
427  return;
428 
431 
432  m_unit = i + 1;
433 
435  RebuildView();
436 }
437 
438 
440 {
441  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
442 
443  if( !libNickname.empty() )
444  {
445  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
446  {
447  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
448  libNickname = wxEmptyString;
449  }
450  }
451 
452  return libNickname;
453 }
454 
455 
456 wxString LIB_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
457 {
458  wxString old = GetCurLib();
459 
460  if( aLibNickname.empty() || !Prj().SchSymbolLibTable()->HasLibrary( aLibNickname ) )
461  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
462  else
463  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, aLibNickname );
464 
465  m_libMgr->SetCurrentLib( aLibNickname );
466 
467  return old;
468 }
469 
470 
472 {
474 
475  if( m_my_part )
476  delete m_my_part;
477 
478  m_my_part = aPart;
479 
480  // select the current component in the tree widget
481  if( m_my_part )
482  {
485  }
486 
487  wxString partName = m_my_part ? m_my_part->GetName() : wxString();
488  m_libMgr->SetCurrentPart( partName );
489 
490  // retain in case this wxFrame is re-opened later on the same PROJECT
492 
493  // Ensure synchronized pin edit can be enabled only symbols with interchangeable units
494  m_SyncPinEdit = aPart && aPart->IsRoot() && aPart->IsMulti() && !aPart->UnitsLocked();
495 
497  RebuildView();
498 }
499 
500 
502 {
503  wxASSERT( m_libMgr );
504  return *m_libMgr;
505 }
506 
507 
508 void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent )
509 {
511  LoadOneSymbol();
512  m_drawToolBar->ToggleTool( ID_LIBEDIT_IMPORT_BODY_BUTT, false );
513 }
514 
515 
516 void LIB_EDIT_FRAME::OnExportBody( wxCommandEvent& aEvent )
517 {
519  SaveOneSymbol();
520  m_drawToolBar->ToggleTool( ID_LIBEDIT_EXPORT_BODY_BUTT, false );
521 }
522 
523 
525 {
526  GetScreen()->SetModify();
528 
530 }
531 
532 
534 {
536 }
537 
538 
540 {
541  // There may be no parent window so use KIWAY message to refresh the schematic editor
542  // in case any symbols have changed.
543  std::string dummyPayload;
544  Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_REFRESH, dummyPayload, this );
545 }
546 
547 
548 bool LIB_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
549 {
550  wxFileName fn = m_libMgr->GetUniqueLibraryName();
551 
552  if( !LibraryFileBrowser( !aCreateNew, fn, SchematicLibraryFileWildcard(),
554  {
555  return false;
556  }
557 
558  wxString libName = fn.GetName();
559 
560  if( libName.IsEmpty() )
561  return false;
562 
563  if( m_libMgr->LibraryExists( libName ) )
564  {
565  DisplayError( this, wxString::Format( _( "Library \"%s\" already exists" ), libName ) );
566  return false;
567  }
568 
569  // Select the target library table (global/project)
570  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
571 
572  if( !libTable )
573  return false;
574 
575  if( aCreateNew )
576  {
577  if( !m_libMgr->CreateLibrary( fn.GetFullPath(), libTable ) )
578  {
579  DisplayError( this, wxString::Format( _( "Could not create the library file '%s'.\n"
580  "Check write permission." ),
581  fn.GetFullPath() ) );
582  return false;
583  }
584  }
585  else
586  {
587  if( !m_libMgr->AddLibrary( fn.GetFullPath(), libTable ) )
588  {
589  DisplayError( this, _( "Could not open the library file." ) );
590  return false;
591  }
592  }
593 
594  bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
595  saveSymbolLibTables( globalTable, !globalTable );
596 
597  return true;
598 }
599 
600 
602 {
603  return m_treePane->GetLibTree()->GetSelectedLibId( aUnit );
604 }
605 
606 
608 {
609  LIB_ID libId = GetTreeLIBID();
610 
611  if( libId.IsValid() )
612  {
613  LIB_PART* alias = m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
614  return alias;
615  }
616 
617  return m_my_part;
618 }
619 
620 
622 {
623  LIB_ID id = GetTreeLIBID();
624 
625  if( id.GetLibNickname().empty() && m_my_part )
626  id = m_my_part->GetLibId();
627 
628  return id;
629 }
630 
631 
633 {
635 }
636 
637 
639 {
640  return getTargetLibId().GetLibNickname();
641 }
642 
643 
644 void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress )
645 {
646  LIB_ID selected;
647 
648  if( m_treePane )
649  selected = m_treePane->GetLibTree()->GetSelectedLibId();
650 
651  if( aShowProgress )
652  {
653  wxProgressDialog progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
654  m_libMgr->GetAdapter()->GetLibrariesCount(), this );
655 
656  m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName )
657  {
658  progressDlg.Update( progress, wxString::Format( _( "Loading library \"%s\"" ),
659  libName ) );
660  } );
661  }
662  else
663  {
664  m_libMgr->Sync( true );
665  }
666 
667  if( m_treePane )
668  {
669  wxDataViewItem found;
670 
671  if( selected.IsValid() )
672  {
673  // Check if the previously selected item is still valid,
674  // if not - it has to be unselected to prevent crash
675  found = m_libMgr->GetAdapter()->FindItem( selected );
676 
677  if( !found )
679  }
680 
681  m_treePane->GetLibTree()->Regenerate( true );
682 
683  // Try to select the parent library, in case the part is not found
684  if( !found && selected.IsValid() )
685  {
686  selected.SetLibItemName( "" );
687  found = m_libMgr->GetAdapter()->FindItem( selected );
688 
689  if( found )
690  m_treePane->GetLibTree()->SelectLibId( selected );
691  }
692 
693  // If no selection, see if there's a current part to centre
694  if( !selected.IsValid() && m_my_part )
695  {
696  LIB_ID current( GetCurLib(), m_my_part->GetName() );
697  m_treePane->GetLibTree()->CenterLibId( current );
698  }
699  }
700 }
701 
702 
704 {
705  LIB_ID target = getTargetLibId();
706 
707  m_treePane->GetLibTree()->Regenerate( true );
708 
709  if( target.IsValid() )
710  m_treePane->GetLibTree()->CenterLibId( target );
711 }
712 
713 
715 {
716  wxArrayString libTableNames;
717  libTableNames.Add( _( "Global" ) );
718  libTableNames.Add( _( "Project" ) );
719 
720  wxSingleChoiceDialog dlg( this, _( "Choose the Library Table to add the library to:" ),
721  _( "Add To Library Table" ), libTableNames );
722 
723  if( aOptional )
724  {
725  dlg.FindWindow( wxID_CANCEL )->SetLabel( _( "Skip" ) );
726  dlg.FindWindow( wxID_OK )->SetLabel( _( "Add" ) );
727  }
728 
729  if( dlg.ShowModal() != wxID_OK )
730  return nullptr;
731 
732  switch( dlg.GetSelection() )
733  {
734  case 0: return &SYMBOL_LIB_TABLE::GetGlobalLibTable();
735  case 1: return Prj().SchSymbolLibTable();
736  default: return nullptr;
737  }
738 }
739 
740 
741 bool LIB_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt )
742 {
743  if( aOriginalFile.FileExists() )
744  {
745  wxFileName backupFileName( aOriginalFile );
746  backupFileName.SetExt( "bck" );
747 
748  if( backupFileName.FileExists() )
749  wxRemoveFile( backupFileName.GetFullPath() );
750 
751  if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
752  {
753  DisplayError( this, wxString::Format( _( "Failed to save backup to \"%s\"" ),
754  backupFileName.GetFullPath() ) );
755  return false;
756  }
757  }
758 
759  return true;
760 }
761 
762 
764 {
765  if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsModify() )
766  m_libMgr->UpdatePart( m_my_part, GetCurLib() ); // UpdatePart() makes a copy
767 }
768 
769 
770 bool LIB_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
771 {
772  // This will return the root part of any alias
773  LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
774  // Now we can compare the libId of the current part and the root part
775  return ( part && m_my_part && part->GetLibId() == m_my_part->GetLibId() );
776 }
777 
778 
780 {
782  SetCurLib( wxEmptyString );
783  SetCurPart( nullptr );
787  Refresh();
788 }
789 
790 
791 void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
792 {
793  SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
794 
796 
797  if( aEnvVarsChanged )
798  SyncLibraries( true );
799 
800  Layout();
801  SendSizeEvent();
802 }
803 
804 
806 {
807  // call my base class
809 
810  // tooltips in toolbars
812 
813  // status bar
814  UpdateMsgPanel();
815 }
816 
817 
819 {
820  SCH_BASE_FRAME::SetScreen( aScreen );
821 }
822 
823 
825 {
832 
833  GetCanvas()->Refresh();
834 }
835 
836 
838 {
839  SyncLibraries( true );
840  RebuildView();
841 }
842 
843 
845 {
846  if( !m_my_part )
847  {
848  return BOX2I( VECTOR2I( Mils2iu( -100 ), Mils2iu( -100 ) ),
849  VECTOR2I( Mils2iu( 200 ), Mils2iu( 200 ) ) );
850  }
851  else
852  {
853  EDA_RECT boundingBox = m_my_part->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
855  boundingBox.GetHeight() ) );
856  }
857 }
858 
859 
861 {
862  const std::string& payload = mail.GetPayload();
863 
864  switch( mail.Command() )
865  {
866  case MAIL_LIB_EDIT:
867  if( !payload.empty() )
868  {
869  wxString libFileName( payload );
870  wxString libNickname;
871  wxString msg;
872 
873  SYMBOL_LIB_TABLE* libTable = Prj().SchSymbolLibTable();
874  const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( libFileName );
875 
876  if( !libTableRow )
877  {
878  msg.Printf( _( "The current configuration does not include the symbol library\n"
879  "\"%s\".\nUse Manage Symbol Libraries to edit the configuration." ),
880  libFileName );
881  DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
882  break;
883  }
884 
885  libNickname = libTableRow->GetNickName();
886 
887  if( !libTable->HasLibrary( libNickname, true ) )
888  {
889  msg.Printf( _( "The library with the nickname \"%s\" is not enabled\n"
890  "in the current configuration. Use Manage Symbol Libraries to\n"
891  "edit the configuration." ), libNickname );
892  DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
893  break;
894  }
895 
896  SetCurLib( libNickname );
897 
898  if( m_treePane )
899  {
900  LIB_ID id( libNickname, wxEmptyString );
903  }
904  }
905 
906  break;
907 
908  default:
909  ;
910  }
911 }
912 
913 
915 {
916  // switches currently used canvas ( Cairo / OpenGL):
917  SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
918 
919  // Set options specific to symbol editor (axies are always enabled):
920  GetCanvas()->GetGAL()->SetAxesEnabled( true );
921 }
922 
923 
925 {
926  wxCHECK( m_libMgr, false );
927 
928  return m_libMgr->HasModifications();
929 }
930 
931 
933 {
934  wxCHECK( m_libMgr, false );
935 
936  // Test if the currently edited part is modified
937  if( GetScreen() && GetScreen()->IsModify() && GetCurPart() )
938  return true;
939 
940  // Test if any library has been modified
941  for( const auto& libNickname : m_libMgr->GetLibraryNames() )
942  {
943  if( m_libMgr->IsLibraryModified( libNickname ) )
944  return true;
945  }
946 
947  return false;
948 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
#define TEXT_ANGLE_HORIZ
void SetScreen(BASE_SCREEN *aScreen) override
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
void Sync(bool aForce=false, std::function< void(int, int, const wxString &)> aProgressCallback=[](int, int, const wxString &){})
Updates the LIB_MANAGER data to synchronize with Symbol Library Table.
Definition: lib_manager.cpp:49
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void OnToggleSearchTree(wxCommandEvent &event)
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
void OnUpdatePartNumber(wxUpdateUIEvent &event)
#define DEFAULTPINLENGTH
The default pin number size when creating pins(can be changed in preference menu)
Definition: general.h:62
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
void SaveOneSymbol()
Saves the current symbol to a symbol file.
Definition: symbedit.cpp:143
KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
void OnKiCadExit()
Definition: kiway.cpp:522
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
Definition: sch_view.cpp:213
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
name of datasheet
LIB_ID GetLibId() const override
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
wxString GetName() const override
Model changes (required full reload)
Definition: tool_base.h:81
This file is part of the common library.
TOOL_DISPATCHER * m_toolDispatcher
void SetRepeatDeltaLabel(int aDelta)
Sets the repeat delta label value for repeat command.
LIB_DRAWING_TOOLS.
void SetRepeatPinStep(int aStep)
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
void Parse(TEMPLATE_FIELDNAMES_LEXER *in, bool aGlobal)
Function Parse fills this object from information in the input stream handled by TEMPLATE_FIELDNAMES_...
void OnImportBody(wxCommandEvent &aEvent)
void OnCloseWindow(wxCloseEvent &Event)
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Creates an empty library and adds it to the library table.
Definition: lib_manager.h:138
LIB_MANAGER * m_libMgr
static int GetDefaultPinLength()
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
TEMPLATES m_templateFieldNames
ACTIONS * m_actions
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
wxString SchematicLibraryFileWildcard()
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of ckeck tools.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
void SetSize(const Vec &size)
Definition: box2.h:211
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
void LoadOneSymbol()
Read a component symbol file (*.sym ) and add graphic items to the current component.
Definition: symbedit.cpp:43
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
switches currently used canvas ( Cairo / OpenGL).
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
#define DEFAULT_REPEAT_OFFSET_PIN
the default value (overwritten by the eeschema config)
Definition: general.h:49
wxAuiManager m_auimgr
bool isCurrentPart(const LIB_ID &aLibId) const
Returns true if aLibId is an alias for the editor screen part.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
The base class for create windows for drawing purpose.
bool IsValid() const
Definition: lib_id.h:171
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.
LIB_PART * m_my_part
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
void SetDefaultLineThickness(int aThickness)
bool m_axesEnabled
Whether or not to draw the coordinate system axes
Library Editor pane with component tree and symbol library table selector.
void OnExportBody(wxCommandEvent &aEvent)
LIB_CONTROL.
Definition: lib_control.h:39
LIB_PART * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Returns either an alias of a working LIB_PART copy, or alias of the original part if there is no work...
#define LIB_EDIT_FRAME_NAME
bool AddLibraryFile(bool aCreateNew)
Creates or adds an existing library to the symbol library table.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:60
TOOL_MANAGER.
Definition: tool_manager.h:50
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
static int GetPinNumDefaultSize()
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
const wxString & GetNickName() const
void HideWorksheet()
Definition: sch_view.cpp:220
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Adds an existing library.
Definition: lib_manager.h:146
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:75
const BOX2I GetDocumentExtents() const override
int GetUnitCount() const override
For items with units, return the number of units.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
LIB_TREE_NODE * GetCurrentTreeNode() const
Definition: lib_tree.cpp:165
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
wxString GetUniqueLibraryName() const
Returns a library name that is not currently in use.
const std::string SchematicLibraryFileExtension
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
coord_type GetWidth() const
Definition: box2.h:196
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit components, if the user selects the component itself rather than picking an individual...
Definition: lib_tree.cpp:147
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
Define a library symbol object.
void Regenerate(bool aKeepState)
Regenerates the tree.
Definition: lib_tree.cpp:199
Definition of file extensions used in Kicad.
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:188
const wxPoint GetRepeatStep() const
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
wxArrayString GetLibraryNames() const
Returns the array of library names.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
wxString GetDocFileName() const
static int m_textPinNumDefaultSize
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void SetCurrentLib(const wxString &aLibrary)
Definition: lib_manager.h:277
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
void SetCurrentPart(const wxString &aPart)
Definition: lib_manager.h:283
void CommonSettingsChanged(bool aEnvVarsChanged) override
Called after the preferences dialog is run.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
COMMON_CONTROL.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:217
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
bool m_showPinElectricalTypeName
The the schematic editor to refresh the display.
Definition: mail_type.h:48
Specialization of the wxAuiPaneInfo class for KiCad panels.
void RebuildSymbolUnitsList()
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:206
EESCHEMA_ACTIONS.
Definition: ee_actions.h:43
COMMON_TOOLS.
Definition: common_tools.h:38
void emptyScreen()
Restores the empty editor screen, without any part or library selected.
TOOL_DISPATCHER.
COLOR_SETTINGS * m_colorSettings
bool UpdatePart(LIB_PART *aPart, const wxString &aLibrary)
Updates the part buffer with a new version of the part.
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:198
bool IsContentModified() override
Get if any parts or libraries have been modified but not saved.
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
static int m_textPinNameDefaultSize
Class to handle modifications to the symbol libraries.
Definition: lib_manager.h:99
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
Definition: lib_tree.cpp:193
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void storeCurrentPart()
Stores the currently modified part in the library manager buffer.
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:427
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Creates a backup copy of a file with requested extension
void SyncLibraries(bool aShowProgress)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
const BITMAP_OPAQUE icon_libedit_xpm[1]
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:213
LIB_PART * GetBufferedPart(const wxString &aAlias, const wxString &aLibrary)
Returns the part copy from the buffer.
The symbol library editor main window.
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:101
see class PGM_BASE
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
bool HasLibModifications() const
Check if any pending libraries have been modified.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
bool saveAllLibraries(bool aRequireConfirmation)
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
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
static int GetPinNameDefaultSize()
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
#define _(s)
Definition: 3d_actions.cpp:33
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Returns true if library exists.
EE_POINT_EDITOR.
void SetScreen(BASE_SCREEN *aScreen) override
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnToggleShowLayerManager GERBVIEW_FRAME::OnSelectHighlightChoice EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox) EVT_UPDATE_UI_RANGE(ID_TB_OPTIONS_SHOW_GBR_MODE_0
bool IsAlias() const
void SetOrigin(const Vec &pos)
Definition: box2.h:209
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
static wxString SubReference(int aUnit, bool aAddSeparator=true)
int GetRepeatDeltaLabel() const
LIB_ID getTargetLibId() const
Returns either the part selected in the component tree, if context menu is active or the currently mo...
static bool empty(const wxTextEntryBase *aCtrl)
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
coord_type GetHeight() const
Definition: box2.h:197
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void OnSelectUnit(wxCommandEvent &event)
bool IsMulti() const
bool HasModifications() const
Definition: lib_manager.cpp:66
#define DEFAULTPINNAMESIZE
The default selection highlight thickness.
Definition: general.h:68
LIB_PART * getTargetPart() const
Returns currently edited part.
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:69
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:42
bool IsLibraryModified(const wxString &aLibrary) const
Returns true if library has unsaved modifications.
void OnGridSettings(wxCommandEvent &aEvent) override
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void SetRepeatStep(const wxPoint &aStep)
Sets the repeat step value for repeat command.
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
wxString SetCurLib(const wxString &aLibNickname)
Sets the current library nickname and returns the old library nickname.
#define DBG(x)
Definition: fctsys.h:33
TOOL_MANAGER * m_toolManager
SYMBOL_LIB_TABLE * selectSymLibTable(bool aOptional=false)
Displays a dialog asking the user to select a symbol library table.
void InitTools()
Function InitTools() Initializes all registered tools.
COLOR_SETTINGS * GetColorSettings() override
Returns a pointer to the active color theme settings.
Definition for part library class.
const Vec & GetOrigin() const
Definition: box2.h:192
#define DEFAULTPINNUMSIZE
The default pin name size when creating pins(can be changed in preference menu)
Definition: general.h:65
wxComboBox * m_unitSelectBox
void SetModify()
Definition: base_screen.h:224
int GetRepeatPinStep() const
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
static void SetDefaultPinLength(int aLength)
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
LIB_MANAGER & GetLibManager()
BASE_SCREEN class implementation.
LIB_TREE_NODE * GetCurrentTreeNode() const
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.
LIB_TREE_MODEL_ADAPTER::PTR & GetAdapter()
Returns the adapter object that provides the stored data.
Definition: lib_manager.h:271
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME,...
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void DisplayComponent(const LIB_PART *aComponent)
std::string & GetPayload()
Function Payload returns the payload, which can be any text but it typicall self identifying s-expres...
Definition: kiway_express.h:62
bool UnitsLocked() const
Check whether part units are interchangeable.
~LIB_EDIT_FRAME() override
wxString getTargetLib() const
Returns either the library selected in the component tree, if context menu is active or the library t...
void RegisterTool(TOOL_BASE *aTool)
Function RegisterTool() Adds a tool to the manager set and sets it up.
int GetDefaultTextSize()
Default size for text in general.
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferrably centered).
Definition: lib_tree.cpp:182
void OnExitKiCad(wxCommandEvent &event)
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:176
bool GetShowElectricalType()
Allow some frames to show/hide pin electrical type names.
virtual void UpdateMsgPanel()
Redraw the message panel.
ACTION_TOOLBAR * m_drawToolBar