KiCad PCB EDA Suite
symbol_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-2021 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 <bitmaps.h>
27 #include <wx/hyperlink.h>
28 #include <base_screen.h>
29 #include <class_library.h>
30 #include <confirm.h>
31 #include <core/kicad_algo.h>
32 #include <eeschema_id.h>
33 #include <eeschema_settings.h>
34 #include <env_paths.h>
35 #include <kiface_i.h>
36 #include <kiplatform/app.h>
37 #include <kiway_express.h>
38 #include <symbol_edit_frame.h>
39 #include <symbol_library_manager.h>
40 #include <lib_text.h>
41 #include <symbol_editor_settings.h>
42 #include <paths.h>
43 #include <pgm_base.h>
44 #include <sch_painter.h>
45 #include <sch_view.h>
47 #include <symbol_lib_table.h>
48 #include <tool/action_manager.h>
49 #include <tool/action_toolbar.h>
50 #include <tool/common_control.h>
51 #include <tool/common_tools.h>
52 #include <tool/editor_conditions.h>
53 #include <tool/picker_tool.h>
54 #include <tool/selection.h>
55 #include <tool/tool_dispatcher.h>
56 #include <tool/tool_manager.h>
57 #include <tool/zoom_tool.h>
58 #include <tools/ee_actions.h>
60 #include <tools/ee_point_editor.h>
68 #include <widgets/infobar.h>
69 #include <widgets/lib_tree.h>
72 #include <panel_sym_lib_table.h>
73 
74 
76 
77 
78 BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, EDA_DRAW_FRAME )
79  EVT_SIZE( SYMBOL_EDIT_FRAME::OnSize )
80 
82 
83  // menubar commands
84  EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad )
85  EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow )
87 
88  // Update user interface elements.
90 
91 END_EVENT_TABLE()
92 
93 
94 SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
95  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ),
96  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
98  m_unitSelectBox( nullptr ),
99  m_isSymbolFromSchematic( false )
100 {
101  SetShowDeMorgan( false );
102  m_SyncPinEdit = false;
103 
104  m_my_part = nullptr;
105  m_treePane = nullptr;
106  m_libMgr = nullptr;
107  m_unit = 1;
108  m_convert = 1;
109  m_aboutTitle = _( "KiCad Symbol Editor" );
110 
111  wxIcon icon;
112  wxIconBundle icon_bundle;
113 
114  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
115  icon_bundle.AddIcon( icon );
116  icon.CopyFromBitmap( KiBitmap( icon_libedit_32_xpm ) );
117  icon_bundle.AddIcon( icon );
118  icon.CopyFromBitmap( KiBitmap( icon_libedit_16_xpm ) );
119  icon_bundle.AddIcon( icon );
120 
121  SetIcons( icon_bundle );
122 
123  m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
124  LoadSettings( m_settings );
125 
126  // Ensure axis are always drawn
127  KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
128  gal_opts.m_axesEnabled = true;
129 
130  m_dummyScreen = new SCH_SCREEN();
131  SetScreen( m_dummyScreen );
132  GetScreen()->m_Center = true;
133 
134  GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
135 
136  GetRenderSettings()->LoadColors( GetColorSettings() );
137  GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
138 
139  setupTools();
140  setupUIConditions();
141 
142  m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this );
143  SyncLibraries( true );
144  m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
145 
146  ReCreateMenuBar();
147  ReCreateHToolbar();
148  ReCreateVToolbar();
149  ReCreateOptToolbar();
150 
151  updateTitle();
152  DisplaySymbolDatasheet();
153  RebuildSymbolUnitsList();
154 
155  m_auimgr.SetManagedWindow( this );
156 
157  CreateInfoBar();
158  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
159  .Top().Layer( 6 ) );
160  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
161  .Bottom().Layer( 6 ) );
162 
163  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
164  .Left().Layer( 3 ) );
165  m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" )
166  .Left().Layer( 2 )
167  .Caption( _( "Libraries" ) )
168  .MinSize( 250, -1 ).BestSize( 250, -1 ) );
169  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
170  .Right().Layer( 2 ) );
171 
172  m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" )
173  .CentrePane() );
174 
175  FinishAUIInitialization();
176 
177  if( m_settings->m_LibWidth > 0 )
178  {
179  wxAuiPaneInfo& treePane = m_auimgr.GetPane( "ComponentTree" );
180 
181  // wxAUI hack: force width by setting MinSize() and then Fixed()
182  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
183  treePane.MinSize( m_settings->m_LibWidth, -1 );
184  treePane.Fixed();
185  m_auimgr.Update();
186 
187  // now make it resizable again
188  treePane.Resizable();
189  m_auimgr.Update();
190 
191  // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
192  // back to minimum.
193  treePane.MinSize( 250, -1 );
194  }
195 
196  Raise();
197  Show( true );
198 
199  SyncView();
200  GetCanvas()->GetView()->UseDrawPriority( true );
201  GetCanvas()->GetGAL()->SetAxesEnabled( true );
202 
203  setupUnits( m_settings );
204 
205  // Set the working/draw area size to display a symbol to a reasonable value:
206  // A 600mm x 600mm with a origin at the area center looks like a large working area
207  double max_size_x = Millimeter2iu( 600 );
208  double max_size_y = Millimeter2iu( 600 );
209  BOX2D bbox;
210  bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
211  bbox.SetSize( max_size_x, max_size_y );
212  GetCanvas()->GetView()->SetBoundary( bbox );
213 
214  m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
215 
216  KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Library changes are unsaved" ) );
217 
218  // Ensure the window is on top
219  Raise();
220 }
221 
222 
224 {
225  // Shutdown all running tools
226  if( m_toolManager )
228 
229  if( IsSymbolFromSchematic() )
230  {
231  delete m_my_part;
232  m_my_part = nullptr;
233 
234  SCH_SCREEN* screen = GetScreen();
235  delete screen;
236  m_isSymbolFromSchematic = false;
237  }
238  // current screen is destroyed in EDA_DRAW_FRAME
240 
241  auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
242  Pgm().GetSettingsManager().Save( libedit );
243 
244  delete m_libMgr;
245 }
246 
247 
249 {
250  wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
251 
253 
255 
256  // Hidden elements must be editable
260 }
261 
262 
264 {
265  wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
266 
268 
270 
272  m_settings->m_LibWidth = m_treePane->GetSize().x;
273 }
274 
275 
277 {
278  SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
279 
280  if( GetSettings()->m_UseEeschemaColorSettings )
282  else
283  return mgr.GetColorSettings( GetSettings()->m_ColorTheme );
284 }
285 
286 
288 {
289  // Create the manager and dispatcher & route draw panel events to the dispatcher
292  GetCanvas()->GetViewControls(), config(), this );
293  m_actions = new EE_ACTIONS();
295 
296  // Register tools
310 
311  // Run the selection tool, it is supposed to be always active
312  m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
313 
315 }
316 
317 
319 {
321 
323  EDITOR_CONDITIONS cond( this );
324 
325  wxASSERT( mgr );
326 
327 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
328 #define CHECK( x ) ACTION_CONDITIONS().Check( x )
329 
330  auto haveSymbolCond =
331  [this] ( const SELECTION& )
332  {
333  return m_my_part;
334  };
335 
336  auto isEditableCond =
337  [this] ( const SELECTION& )
338  {
339  // Only root symbols from the new s-expression libraries or the schematic
340  // are editable.
341  return IsSymbolEditable() && !IsSymbolAlias();
342  };
343 
344  auto libModifiedCondition =
345  [this] ( const SELECTION& sel )
346  {
347  return m_libMgr->HasModifications();
348  };
349 
350  auto libSelectedCondition =
351  [this] ( const SELECTION& sel )
352  {
353  return !GetTargetLibId().GetLibNickname().empty();
354  };
355 
356  auto canEditLib =
357  [this] ( const SELECTION& sel )
358  {
359  const wxString libName = GetTargetLibId().GetLibNickname();
360 
361  return !libName.empty() && m_libMgr->LibraryExists( libName )
362  && !m_libMgr->IsLibraryReadOnly( libName );
363  };
364 
365  auto canEditProperties =
366  [this] ( const SELECTION& sel )
367  {
369  };
370 
371  auto saveSymbolAsCondition =
372  [ this ]( const SELECTION& aSel )
373  {
374  LIB_ID sel = GetTargetLibId();
375  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
376  };
377 
380  mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
381  mgr->SetConditions( EE_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
382  mgr->SetConditions( EE_ACTIONS::newSymbol, ENABLE( !libSelectedCondition || canEditLib ) );
383  mgr->SetConditions( EE_ACTIONS::importSymbol, ENABLE( !libSelectedCondition || canEditLib ) );
384 
385  mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
386  mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
387  mgr->SetConditions( ACTIONS::revert, ENABLE( haveSymbolCond && libModifiedCondition ) );
388 
394 
395  mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) );
396  mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) );
397  mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond && SELECTION_CONDITIONS::Idle ) );
398  mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
399  mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
400  mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
401 
402  mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( isEditableCond ) );
403  mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( isEditableCond ) );
404  mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
405  mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
406 
409 
410  auto pinTypeCond =
411  [this] ( const SELECTION& )
412  {
414  };
415 
416  auto showCompTreeCond =
417  [this] ( const SELECTION& )
418  {
419  return IsSearchTreeShown();
420  };
421 
422  mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( pinTypeCond ) );
423  mgr->SetConditions( EE_ACTIONS::showComponentTree, CHECK( showCompTreeCond ) );
424 
425  auto demorganCond =
426  [this] ( const SELECTION& )
427  {
428  return GetShowDeMorgan();
429  };
430 
431  auto demorganStandardCond =
432  [this] ( const SELECTION& )
433  {
434  return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
435  };
436 
437  auto demorganAlternateCond =
438  [this] ( const SELECTION& )
439  {
440  return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
441  };
442 
443  auto multiUnitModeCond =
444  [this] ( const SELECTION& )
445  {
446  return m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked();
447  };
448 
449  auto syncedPinsModeCond =
450  [this] ( const SELECTION& )
451  {
452  return m_SyncPinEdit;
453  };
454 
455  auto haveDatasheetCond =
456  [this] ( const SELECTION& )
457  {
458  return m_my_part && !m_my_part->GetDatasheetField().GetText().IsEmpty();
459  };
460 
461  mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
462  mgr->SetConditions( EE_ACTIONS::symbolProperties, ENABLE( canEditProperties && haveSymbolCond ) );
463  mgr->SetConditions( EE_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
464  mgr->SetConditions( EE_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
465 
467  ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
469  ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
471  ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
472 
473 // Only enable a tool if the part is edtable
474 #define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
475 
484 
485 #undef CHECK
486 #undef ENABLE
487 #undef EDIT_TOOL
488 }
489 
490 
491 bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
492 {
493  // Shutdown blocks must be determined and vetoed as early as possible
494  if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
495  && IsContentModified() )
496  {
497  return false;
498  }
499 
501  {
502  SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
503 
504  switch( UnsavedChangesDialog( this,
505  _( "Save changes to schematic before closing?" ),
506  nullptr ) )
507  {
508  case wxID_YES:
509  if( schframe && GetCurPart() ) // Should be always the case
510  schframe->UpdateSymbolFromEditor( *GetCurPart() );
511 
512  return true;
513 
514  case wxID_NO: return true;
515 
516  default:
517  case wxID_CANCEL: return false;
518  }
519  }
520 
521  if( !saveAllLibraries( true ) )
522  {
523  return false;
524  }
525 
526  return true;
527 }
528 
529 
531 {
532  Destroy();
533 }
534 
535 
537 {
538  if( !m_unitSelectBox )
539  return;
540 
541  if( m_unitSelectBox->GetCount() != 0 )
542  m_unitSelectBox->Clear();
543 
544  if( !m_my_part || m_my_part->GetUnitCount() <= 1 )
545  {
546  m_unit = 1;
547  m_unitSelectBox->Append( wxEmptyString );
548  }
549  else
550  {
551  for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
552  {
553  wxString sub = LIB_PART::SubReference( i+1, false );
554  wxString unit = wxString::Format( _( "Unit %s" ), sub );
555  m_unitSelectBox->Append( unit );
556  }
557  }
558 
559  // Ensure the selected unit is compatible with the number of units of the current part:
560  if( m_my_part && m_my_part->GetUnitCount() < m_unit )
561  m_unit = 1;
562 
563  m_unitSelectBox->SetSelection(( m_unit > 0 ) ? m_unit - 1 : 0 );
564 }
565 
566 
567 void SYMBOL_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
568 {
569  auto& treePane = m_auimgr.GetPane( m_treePane );
570  treePane.Show( !IsSearchTreeShown() );
571  m_auimgr.Update();
572 }
573 
574 
576 {
577  return m_auimgr.GetPane( m_treePane ).IsShown();
578 }
579 
580 
582 {
583  m_treePane->Freeze();
584  m_libMgr->GetAdapter()->Freeze();
585 }
586 
587 
589 {
590  m_libMgr->GetAdapter()->Thaw();
591  m_treePane->Thaw();
592 }
593 
594 
595 void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
596 {
597  Kiway().OnKiCadExit();
598 }
599 
600 
601 void SYMBOL_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
602 {
603  if( !m_unitSelectBox )
604  return;
605 
606  // Using the typical event.Enable() call doesn't seem to work with wxGTK
607  // so use the pointer to alias combobox to directly enable or disable.
608  m_unitSelectBox->Enable( m_my_part && m_my_part->GetUnitCount() > 1 );
609 }
610 
611 
612 void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
613 {
614  int i = event.GetSelection();
615 
616  if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) == m_unit ) )
617  return;
618 
621 
622  m_unit = i + 1;
623 
625  RebuildView();
626 }
627 
628 
630 {
631  if( m_my_part )
632  {
634 
635  if( row && row->GetType() == SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) )
636  return true;
637  }
638 
639  return false;
640 }
641 
642 
644 {
645  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
646 
647  if( !libNickname.empty() )
648  {
649  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
650  {
651  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
652  libNickname = wxEmptyString;
653  }
654  }
655 
656  return libNickname;
657 }
658 
659 
660 wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
661 {
662  wxString old = GetCurLib();
663 
664  if( aLibNickname.empty() || !Prj().SchSymbolLibTable()->HasLibrary( aLibNickname ) )
665  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
666  else
667  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, aLibNickname );
668 
669  return old;
670 }
671 
672 
673 void SYMBOL_EDIT_FRAME::SetCurPart( LIB_PART* aPart, bool aUpdateZoom )
674 {
676  GetCanvas()->GetView()->Clear();
677  delete m_my_part;
678 
679  m_my_part = aPart;
680 
681  // select the current component in the tree widget
682  if( !IsSymbolFromSchematic() && m_my_part )
684  else
686 
687  wxString partName = m_my_part ? m_my_part->GetName() : wxString();
688 
689  // retain in case this wxFrame is re-opened later on the same PROJECT
691 
692  // Ensure synchronized pin edit can be enabled only symbols with interchangeable units
693  m_SyncPinEdit = aPart && aPart->IsRoot() && aPart->IsMulti() && !aPart->UnitsLocked();
694 
696 
704 
705  if( aUpdateZoom )
707 
708  GetCanvas()->Refresh();
709 
710  WX_INFOBAR* infobar = GetInfoBar();
711 
712  if( IsSymbolFromSchematic() )
713  {
714  wxString msg;
715  msg.Printf( _( "Editing symbol %s from schematic. Saving will update the schematic "
716  "only." ), m_reference );
717 
718  infobar->RemoveAllButtons();
719  infobar->ShowMessage( msg, wxICON_INFORMATION );
720  }
721  else if( IsSymbolFromLegacyLibrary() )
722  {
723  wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY,
724  _( "Manage symbol libraries" ),
725  wxEmptyString );
726 
727  button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
728  [&]( wxHyperlinkEvent& aEvent )
729  {
731  } ) );
732 
733  infobar->RemoveAllButtons();
734  infobar->AddButton( button );
735  infobar->ShowMessage( _( "Symbols in legacy libraries are not editable. Use Manage "
736  "Symbol Libraries to migrate to current format." ),
737  wxICON_INFORMATION );
738  }
739  else if( IsSymbolAlias() )
740  {
741  wxString parentPartName = m_my_part->GetParent().lock()->GetName();
742  wxString msg;
743  wxString link;
744 
745  msg.Printf( _( "Symbol %s is derived from %s. Symbol graphics will not be editable." ),
746  partName,
747  parentPartName );
748 
749  link.Printf( _( "Open %s" ), parentPartName );
750 
751  wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
752  button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
753  [&]( wxHyperlinkEvent& aEvent )
754  {
755  LoadSymbolFromCurrentLib( m_my_part->GetParent().lock()->GetName(),
756  GetUnit(), GetConvert() );
757  } ) );
758 
759  infobar->RemoveAllButtons();
760  infobar->AddButton( button );
761  infobar->ShowMessage( msg, wxICON_INFORMATION );
762  }
763  else
764  {
765  infobar->Dismiss();
766  }
767 }
768 
769 
771 {
772  wxASSERT( m_libMgr );
773  return *m_libMgr;
774 }
775 
776 
778 {
779  GetScreen()->SetModify();
781 
783 
784  if( !GetTitle().StartsWith( "*" ) )
785  updateTitle();
786 }
787 
788 
790 {
792 }
793 
794 
795 bool SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
796 {
797  // Select the target library table (global/project)
798  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
799 
800  if( !libTable )
801  return false;
802 
803  wxFileName fn = m_libMgr->GetUniqueLibraryName();
804 
805  if( !LibraryFileBrowser( !aCreateNew, fn, KiCadSymbolLibFileWildcard(),
807  ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
809  {
810  return false;
811  }
812 
813  wxString libName = fn.GetName();
814 
815  if( libName.IsEmpty() )
816  return false;
817 
818  if( m_libMgr->LibraryExists( libName ) )
819  {
820  DisplayError( this, wxString::Format( _( "Library \"%s\" already exists" ), libName ) );
821  return false;
822  }
823 
824  if( aCreateNew )
825  {
826  if( !m_libMgr->CreateLibrary( fn.GetFullPath(), libTable ) )
827  {
828  DisplayError( this, wxString::Format( _( "Could not create the library file '%s'.\n"
829  "Check write permission." ),
830  fn.GetFullPath() ) );
831  return false;
832  }
833  }
834  else
835  {
836  if( !m_libMgr->AddLibrary( fn.GetFullPath(), libTable ) )
837  {
838  DisplayError( this, _( "Could not open the library file." ) );
839  return false;
840  }
841  }
842 
843  bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
844  saveSymbolLibTables( globalTable, !globalTable );
845 
846  return true;
847 }
848 
849 
851 {
852  return m_treePane->GetLibTree()->GetSelectedLibId( aUnit );
853 }
854 
855 
857 {
858  LIB_ID libId = GetTreeLIBID();
859 
860  if( libId.IsValid() )
861  {
862  LIB_PART* alias = m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
863  return alias;
864  }
865 
866  return m_my_part;
867 }
868 
869 
871 {
872  LIB_ID id = GetTreeLIBID();
873 
874  if( id.GetLibNickname().empty() && m_my_part )
875  id = m_my_part->GetLibId();
876 
877  return id;
878 }
879 
880 
882 {
884 }
885 
886 
888 {
889  return GetTargetLibId().GetLibNickname();
890 }
891 
892 
893 void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, const wxString& aForceRefresh )
894 {
895  LIB_ID selected;
896 
897  if( m_treePane )
898  selected = m_treePane->GetLibTree()->GetSelectedLibId();
899 
900  if( aShowProgress )
901  {
902  APP_PROGRESS_DIALOG progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
903  m_libMgr->GetAdapter()->GetLibrariesCount(), this );
904 
905  m_libMgr->Sync( aForceRefresh,
906  [&]( int progress, int max, const wxString& libName )
907  {
908  progressDlg.Update( progress,
909  wxString::Format( _( "Loading library '%s'" ), libName ) );
910  } );
911  }
912  else
913  {
914  m_libMgr->Sync( aForceRefresh,
915  [&]( int progress, int max, const wxString& libName )
916  {
917  } );
918  }
919 
920  if( m_treePane )
921  {
922  wxDataViewItem found;
923 
924  if( selected.IsValid() )
925  {
926  // Check if the previously selected item is still valid,
927  // if not - it has to be unselected to prevent crash
928  found = m_libMgr->GetAdapter()->FindItem( selected );
929 
930  if( !found )
932  }
933 
934  m_treePane->GetLibTree()->Regenerate( true );
935 
936  // Try to select the parent library, in case the part is not found
937  if( !found && selected.IsValid() )
938  {
939  selected.SetLibItemName( "" );
940  found = m_libMgr->GetAdapter()->FindItem( selected );
941 
942  if( found )
943  m_treePane->GetLibTree()->SelectLibId( selected );
944  }
945 
946  // If no selection, see if there's a current part to centre
947  if( !selected.IsValid() && m_my_part )
948  {
949  LIB_ID current( GetCurLib(), m_my_part->GetName() );
950  m_treePane->GetLibTree()->CenterLibId( current );
951  }
952  }
953 }
954 
955 
957 {
958  LIB_ID target = GetTargetLibId();
959 
960  m_treePane->GetLibTree()->Regenerate( true );
961 
962  if( target.IsValid() )
963  m_treePane->GetLibTree()->CenterLibId( target );
964 }
965 
966 
968 {
969  // If no project is loaded, always work with the global table
970  if( Prj().IsNullProject() )
971  {
973 
974  if( aOptional )
975  {
976  wxMessageDialog dlg( this, _( "Add the library to the global library table?" ),
977  _( "Add To Global Library Table" ), wxYES_NO );
978 
979  if( dlg.ShowModal() != wxID_OK )
980  ret = nullptr;
981  }
982 
983  return ret;
984  }
985 
986  wxArrayString libTableNames;
987  libTableNames.Add( _( "Global" ) );
988  libTableNames.Add( _( "Project" ) );
989 
990  wxSingleChoiceDialog dlg( this, _( "Choose the Library Table to add the library to:" ),
991  _( "Add To Library Table" ), libTableNames );
992 
993  if( aOptional )
994  {
995  dlg.FindWindow( wxID_CANCEL )->SetLabel( _( "Skip" ) );
996  dlg.FindWindow( wxID_OK )->SetLabel( _( "Add" ) );
997  }
998 
999  if( dlg.ShowModal() != wxID_OK )
1000  return nullptr;
1001 
1002  switch( dlg.GetSelection() )
1003  {
1004  case 0: return &SYMBOL_LIB_TABLE::GetGlobalLibTable();
1005  case 1: return Prj().SchSymbolLibTable();
1006  default: return nullptr;
1007  }
1008 }
1009 
1010 
1011 bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt )
1012 {
1013  if( aOriginalFile.FileExists() )
1014  {
1015  wxFileName backupFileName( aOriginalFile );
1016  backupFileName.SetExt( aBackupExt );
1017 
1018  if( backupFileName.FileExists() )
1019  wxRemoveFile( backupFileName.GetFullPath() );
1020 
1021  if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1022  {
1023  DisplayError( this, wxString::Format( _( "Failed to save backup to \"%s\"" ),
1024  backupFileName.GetFullPath() ) );
1025  return false;
1026  }
1027  }
1028 
1029  return true;
1030 }
1031 
1032 
1034 {
1035  if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsModify() )
1036  m_libMgr->UpdatePart( m_my_part, GetCurLib() ); // UpdatePart() makes a copy
1037 }
1038 
1039 
1040 bool SYMBOL_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
1041 {
1042  // This will return the root part of any alias
1043  LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
1044  // Now we can compare the libId of the current part and the root part
1045  return ( part && m_my_part && part->GetLibId() == m_my_part->GetLibId() );
1046 }
1047 
1048 
1050 {
1052  SetCurLib( wxEmptyString );
1053  SetCurPart( nullptr, false );
1057  Refresh();
1058 }
1059 
1060 
1061 void SYMBOL_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1062 {
1063  SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1064 
1066  GetCanvas()->GetGAL()->DrawGrid();
1067 
1068  RecreateToolbars();
1069 
1070  if( aEnvVarsChanged )
1071  SyncLibraries( true );
1072 
1073  Layout();
1074  SendSizeEvent();
1075 }
1076 
1077 
1079 {
1080  // call my base class
1082 
1083  // tooltips in toolbars
1084  RecreateToolbars();
1085 
1086  // status bar
1087  UpdateMsgPanel();
1088 }
1089 
1090 
1092 {
1093  SCH_BASE_FRAME::SetScreen( aScreen );
1094 }
1095 
1096 
1098 {
1106 
1107  GetCanvas()->Refresh();
1108 }
1109 
1110 
1112 {
1113  SyncLibraries( true );
1114 
1115  if( m_my_part )
1116  {
1118  EE_SELECTION& selection = selectionTool->GetSelection();
1119 
1120  for( LIB_ITEM& item : m_my_part->GetDrawItems() )
1121  {
1122  if( !alg::contains( selection, &item ) )
1123  item.ClearSelected();
1124  else
1125  item.SetSelected();
1126  }
1127  }
1128 
1129  RebuildView();
1130 }
1131 
1132 
1133 const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1134 {
1135  if( !m_my_part )
1136  {
1137  return BOX2I( VECTOR2I( Mils2iu( -100 ), Mils2iu( -100 ) ),
1138  VECTOR2I( Mils2iu( 200 ), Mils2iu( 200 ) ) );
1139  }
1140  else
1141  {
1142  EDA_RECT boundingBox = m_my_part->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
1144  boundingBox.GetHeight() ) );
1145  }
1146 }
1147 
1148 
1150 {
1151  const std::string& payload = mail.GetPayload();
1152 
1153  switch( mail.Command() )
1154  {
1155  case MAIL_LIB_EDIT:
1156  if( !payload.empty() )
1157  {
1158  wxString libFileName( payload );
1159  wxString libNickname;
1160  wxString msg;
1161 
1162  SYMBOL_LIB_TABLE* libTable = Prj().SchSymbolLibTable();
1163  const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( libFileName );
1164 
1165  if( !libTableRow )
1166  {
1167  msg.Printf( _( "The current configuration does not include the library '%s'.\n"
1168  "Use Manage Symbol Libraries to edit the configuration." ),
1169  libFileName );
1170  DisplayErrorMessage( this, _( "Library not found in symbol library table." ), msg );
1171  break;
1172  }
1173 
1174  libNickname = libTableRow->GetNickName();
1175 
1176  if( !libTable->HasLibrary( libNickname, true ) )
1177  {
1178  msg.Printf( _( "The library '%s' is not enabled in the current configuration.\n"
1179  "Use Manage Symbol Libraries to edit the configuration." ),
1180  libNickname );
1181  DisplayErrorMessage( this, _( "Symbol library not enabled." ), msg );
1182  break;
1183  }
1184 
1185  SetCurLib( libNickname );
1186 
1187  if( m_treePane )
1188  {
1189  LIB_ID id( libNickname, wxEmptyString );
1190  m_treePane->GetLibTree()->ExpandLibId( id );
1191  m_treePane->GetLibTree()->CenterLibId( id );
1192  }
1193  }
1194 
1195  break;
1196 
1197  default:
1198  ;
1199  }
1200 }
1201 
1202 
1204 {
1205  // switches currently used canvas ( Cairo / OpenGL):
1206  SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
1207 
1208  // Set options specific to symbol editor (axies are always enabled):
1209  GetCanvas()->GetGAL()->SetAxesEnabled( true );
1211 }
1212 
1213 
1215 {
1216  wxCHECK( m_libMgr, false );
1217 
1218  return m_libMgr->HasModifications();
1219 }
1220 
1221 
1223 {
1224  wxCHECK( m_libMgr, false );
1225 
1226  // Test if the currently edited part is modified
1227  if( GetScreen() && GetScreen()->IsModify() && GetCurPart() )
1228  return true;
1229 
1230  // Test if any library has been modified
1231  for( const auto& libNickname : m_libMgr->GetLibraryNames() )
1232  {
1233  if( m_libMgr->IsLibraryModified( libNickname )
1234  && !m_libMgr->IsLibraryReadOnly( libNickname ) )
1235  return true;
1236  }
1237 
1238  return false;
1239 }
1240 
1241 
1243 {
1244  if( aItemCount == 0 )
1245  return;
1246 
1247  UNDO_REDO_CONTAINER& list = whichList == UNDO_LIST ? m_undoList : m_redoList;
1248 
1249  for( PICKED_ITEMS_LIST* command : list.m_CommandsList )
1250  {
1251  command->ClearListAndDeleteItems();
1252  delete command;
1253  }
1254 
1255  list.m_CommandsList.clear();
1256 }
1257 
1258 
1260 {
1261  return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1262 }
1263 
1264 
1266 {
1267  std::unique_ptr<LIB_PART> part = aSymbol->GetPartRef()->Flatten();
1268  wxCHECK( part, /* void */ );
1269 
1270  std::vector<LIB_FIELD> fullSetOfFields;
1271 
1272  for( int i = 0; i < (int) aSymbol->GetFields().size(); ++i )
1273  {
1274  const SCH_FIELD& field = aSymbol->GetFields()[i];
1275  wxPoint pos = field.GetPosition() - aSymbol->GetPosition();
1276  LIB_FIELD libField( part.get(), field.GetId() );
1277 
1278  if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() )
1279  libField.SetName( field.GetName( false ) );
1280 
1281  libField.SetText( field.GetText() );
1282  libField.SetEffects( field );
1283  libField.SetPosition( wxPoint( pos.x, -pos.y ) );
1284 
1285  fullSetOfFields.emplace_back( std::move( libField ) );
1286  }
1287 
1288  part->SetFields( fullSetOfFields );
1289 
1290  if( m_my_part )
1291  SetCurPart( nullptr, false );
1292 
1293  m_isSymbolFromSchematic = true;
1294  m_reference = part->GetFieldById( REFERENCE_FIELD )->GetText();
1295  m_unit = std::max( 1, aSymbol->GetUnit() );
1296  m_convert = std::max( 1, aSymbol->GetConvert() );
1297 
1298  // The buffered screen for the part
1299  SCH_SCREEN* tmpScreen = new SCH_SCREEN();
1300 
1301  SetScreen( tmpScreen );
1302  SetCurPart( part.release(), true );
1303 
1304  ReCreateMenuBar();
1305  ReCreateHToolbar();
1306 
1307  if( IsSearchTreeShown() )
1308  {
1309  wxCommandEvent evt;
1310  OnToggleSearchTree( evt );
1311  }
1312 
1313  updateTitle();
1315  SetShowDeMorgan( GetCurPart()->HasConversion() );
1317  Refresh();
1318 }
1319 
1320 
1321 bool SYMBOL_EDIT_FRAME::addLibTableEntry( const wxString& aLibFile, TABLE_SCOPE aScope )
1322 {
1323  wxFileName fn = aLibFile;
1324  wxFileName libTableFileName( Prj().GetProjectPath(),
1326  wxString libNickname = fn.GetName();
1327  SYMBOL_LIB_TABLE* libTable = Prj().SchSymbolLibTable();
1328  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1329 
1330  if( libTable->HasLibrary( libNickname ) )
1331  {
1332  wxString tmp;
1333  int suffix = 1;
1334 
1335  while( libTable->HasLibrary( libNickname ) )
1336  {
1337  tmp.Printf( "%s%d", fn.GetName(), suffix );
1338  libNickname = tmp;
1339  suffix += 1;
1340  }
1341  }
1342 
1344  row->SetNickName( libNickname );
1345 
1346  wxString normalizedPath = NormalizePath( aLibFile, &envVars, Prj().GetProjectPath() );
1347 
1348  if( aScope == GLOBAL_LIB_TABLE )
1349  {
1351  libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();
1352 
1353  // We cannot normalize against the current project path when saving to global table.
1354  normalizedPath = NormalizePath( aLibFile, &envVars, wxEmptyString );
1355  }
1356 
1357  if( normalizedPath.IsEmpty() )
1358  normalizedPath = aLibFile;
1359 
1360  row->SetFullURI( normalizedPath );
1361 
1362  wxCHECK( libTable->InsertRow( row ), false );
1363 
1364  try
1365  {
1366  libTable->Save( libTableFileName.GetFullPath() );
1367  }
1368  catch( const IO_ERROR& ioe )
1369  {
1370  wxString msg = aScope == GLOBAL_LIB_TABLE ? _( "Error saving global library table." )
1371  : _( "Error saving project library table." );
1372 
1373  wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1374  dlg.SetExtendedMessage( ioe.What() );
1375  dlg.ShowModal();
1376 
1377  return false;
1378  }
1379 
1380  return true;
1381 }
1382 
1383 
1384 bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname,
1385  const wxString& aLibFile )
1386 {
1387  // Check the global library table first because checking the project library table
1388  // checks the global library table as well due to library chaining.
1389  bool isGlobalTable = true;
1390  wxFileName libTableFileName = SYMBOL_LIB_TABLE::GetGlobalTableFileName();;
1391  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
1393  SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLibNickname );
1394 
1395  if( !row )
1396  {
1397  libTableFileName.SetPath( Prj().GetProjectPath() );
1398  libTableFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
1399  libTable = Prj().SchSymbolLibTable();
1400  isGlobalTable = false;
1401  row = libTable->FindRow( aLibNickname );
1402  }
1403 
1404  wxCHECK( row, false );
1405 
1406  wxString projectPath;
1407 
1408  if( !isGlobalTable )
1409  projectPath = Prj().GetProjectPath();
1410 
1411  wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath );
1412 
1413  if( normalizedPath.IsEmpty() )
1414  normalizedPath = aLibFile;
1415 
1416  row->SetFullURI( normalizedPath );
1417  row->SetType( "KiCad" );
1418 
1419  try
1420  {
1421  libTable->Save( libTableFileName.GetFullPath() );
1422  }
1423  catch( const IO_ERROR& ioe )
1424  {
1425  wxString msg = isGlobalTable ? _( "Error saving global library table." )
1426  : _( "Error saving project library table." );
1427 
1428  wxMessageDialog dlg( this, msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1429  dlg.SetExtendedMessage( ioe.What() );
1430  dlg.ShowModal();
1431 
1432  return false;
1433  }
1434 
1435  return true;
1436 }
1437 
1438 
1440 {
1441  return m_my_part && !m_my_part->IsRoot();
1442 }
1443 
1444 
1446 {
1448 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
Field Reference of part, i.e. "IC21".
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static TOOL_ACTION pinTable
Definition: ee_actions.h:143
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static const wxString & GetSymbolLibTableFileName()
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:124
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:137
int m_convert
Flag if the symbol being edited was loaded directly from a schematic.
static TOOL_ACTION placeSymbolText
Definition: ee_actions.h:99
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:103
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:38
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:236
void OnKiCadExit()
Definition: kiway.cpp:587
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
LIB_PART * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Return either an alias of a working LIB_PART copy, or alias of the original part if there is no worki...
KIWAY & Kiway() const
Return 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:171
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
void DisplayComponent(LIB_PART *aComponent)
LIB_ID GetLibId() const override
Definition: lib_symbol.h:131
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
SCH_SCREEN * m_dummyScreen
< Helper screen used when no part is loaded
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:265
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
wxString GetName() const override
Definition: lib_symbol.h:129
Model changes (required full reload)
Definition: tool_base.h:81
static TOOL_ACTION runERC
Definition: ee_actions.h:138
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
This file is part of the common library.
static TOOL_ACTION doDelete
Definition: actions.h:75
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
bool backupFile(const wxFileName &aOriginalFile, const wxString &aBackupExt)
Return currently edited part.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Add an existing library.
virtual void SetScreen(BASE_SCREEN *aScreen)
UNDO_REDO_CONTAINER m_undoList
static TOOL_ACTION zoomTool
Definition: actions.h:102
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
void SetScreen(BASE_SCREEN *aScreen) override
void SetShowDeMorgan(bool show)
void SetType(const wxString &aType) override
Change the schematic plugin type represented by this row.
wxString GetLibNickname() const override
Definition: lib_symbol.h:134
SYMBOL_EDITOR_SETTINGS * GetSettings() const
bool IsContentModified() override
Get if any parts or libraries have been modified but not saved.
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
Definition: sch_io_mgr.cpp:87
wxPoint GetPosition() const override
Definition: sch_field.cpp:671
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
Field object used in symbol libraries.
Definition: lib_field.h:59
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
LIB_PART * getTargetPart() const
Return either the library selected in the symbol tree, if context menu is active or the library that ...
void OnUpdatePartNumber(wxUpdateUIEvent &event)
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
SYMBOL_TREE_PANE * m_treePane
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas ( Cairo / OpenGL).
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
int GetId() const
Definition: sch_field.h:120
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void SetSize(const Vec &size)
Definition: box2.h:212
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static bool m_showDeMorgan
Schematic editor (Eeschema) main window.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
wxAuiManager m_auimgr
static TOOL_ACTION showComponentTree
Definition: ee_actions.h:201
const BITMAP_OPAQUE icon_libedit_16_xpm[1]
Manage TOOL_ACTION objects.
static TOOL_ACTION mirrorH
Definition: ee_actions.h:117
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.
void SetName(const wxString &aName)
Set a user definable field name to aName.
Definition: lib_field.cpp:387
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:168
wxString m_reference
The reference of the symbol.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
LIB_TREE_NODE * GetCurrentTreeNode() const
bool UpdatePart(LIB_PART *aPart, const wxString &aLibrary)
Update the part buffer with a new version of the part.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:125
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
SYMBOL_LIB_TABLE * selectSymLibTable(bool aOptional=false)
Display a dialog asking the user to select a symbol library table.
void OnSelectUnit(wxCommandEvent &event)
virtual const wxString GetProjectPath() const
Return the full path of the project.
Class that groups generic conditions for editor states.
bool GetShowDeMorgan() const
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
bool IsSymbolFromSchematic() const
The base class for drawable items used by schematic library components.
Definition: lib_item.h:62
static TOOL_ACTION mirrorV
Definition: ee_actions.h:116
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:724
#define CHECK(x)
static TOOL_ACTION drawSymbolRectangle
Definition: ee_actions.h:100
bool m_axesEnabled
Fullscreen crosshair or small cross.
Library Editor pane with component tree and symbol library table selector.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
#define LIB_EDIT_FRAME_NAME
EE_SELECTION & GetSelection()
Return the set of currently selected items.
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:51
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:60
Master controller class:
Definition: tool_manager.h:52
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
A holder to handle a list of undo (or redo) commands.
static TOOL_ACTION copy
Definition: actions.h:70
const wxString & GetNickName() const
LIB_PART * GetBufferedPart(const wxString &aAlias, const wxString &aLibrary)
Return the part copy from the buffer.
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:115
int GetUnit() const
Definition: sch_symbol.h:236
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:166
static TOOL_ACTION placeSymbolPin
Definition: ee_actions.h:98
void DisplaySymbolDatasheet()
Display the documentation of the selected symbol.
void UpdateSymbolFromEditor(const LIB_PART &aSymbol)
Update the LIB_PART of the currently selected symbol.
void updateTitle()
Update the main window title bar with the current library name and read only status of the library.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
wxString GetUniqueLibraryName() const
Return a library name that is not currently in use.
int GetUnitCount() const override
For items with units, return the number of units.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
LIB_TREE_NODE * GetCurrentTreeNode() const
Definition: lib_tree.cpp:166
bool IsSymbolAlias() const
Restore the empty editor screen, without any part or library selected.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:113
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void Clear()
Remove all items from the view.
Definition: view.cpp:1083
static TOOL_ACTION toggleGrid
Definition: actions.h:143
Class to handle modifications to the symbol libraries.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:467
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
static TOOL_ACTION inchesUnits
Definition: actions.h:147
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:40
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
coord_type GetWidth() const
Definition: box2.h:197
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:142
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
wxString getTargetLib() const
const wxString GetType() const override
Return the type of symbol library table represented by this row.
SYMBOL_LIBRARY_MANAGER & GetLibManager()
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:148
void HardRedraw() override
Rebuild the GAL and redraw the screen.
PART_REF & GetParent()
Definition: lib_symbol.h:120
ACTIONS * m_actions
Definition: tools_holder.h:158
virtual void DrawGrid()
static TOOL_ACTION cut
Definition: actions.h:69
static TOOL_ACTION drawSymbolCircle
Definition: ee_actions.h:101
Define a library symbol object.
Definition: lib_symbol.h:93
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:200
Definition of file extensions used in Kicad.
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:189
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void ReCreateHToolbar() override
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
KIGFX::GAL * GetGAL() const
Return 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:92
AppSettings * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
bool replaceLibTableEntry(const wxString &aLibNickname, const wxString &aLibFile)
Replace the file path of the symbol library table entry aLibNickname with aLibFile.
wxString KiCadSymbolLibFileWildcard()
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:40
#define KICAD_DEFAULT_DRAWFRAME_STYLE
static TOOL_ACTION importSymbol
Definition: ee_actions.h:176
void SetCurPart(LIB_PART *aPart, bool aUpdateZoom)
Take ownership of aPart and notes that it is the one currently being edited.
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:54
void storeCurrentPart()
Return true if aLibId is an alias for the editor screen part.
std::unique_ptr< LIB_PART > & GetPartRef()
Definition: sch_symbol.h:205
void Sync(const wxString &aForceRefresh, std::function< void(int, int, const wxString &)> aProgressCallback)
Updates the SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table.
A holder to handle information on schematic or board items.
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.
Definition: lib_symbol.cpp:334
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
int UnsavedChangesDialog(wxWindow *parent, wxString aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition: confirm.cpp:154
Handle actions that are shared between different applications.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:218
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
bool HasLibModifications() const
Check if any pending libraries have been modified.
void ReCreateMenuBar() override
Recreates the menu bar.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
Specialization of the wxAuiPaneInfo class for KiCad panels.
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:124
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
bool addLibTableEntry(const wxString &aLibFile, TABLE_SCOPE aScope=GLOBAL_LIB_TABLE)
Add aLibFile to the symbol library table defined by aScope.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:200
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
UNDO_REDO_CONTAINER m_redoList
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:277
static TOOL_ACTION milsUnits
Definition: actions.h:148
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
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:204
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:159
Gather all the actions that are shared by tools.
Definition: ee_actions.h:39
Handles action that are shared between different applications.
Definition: common_tools.h:37
COLOR_SETTINGS * m_colorSettings
The current canvas type.
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
UNDO_REDO_LIST
Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if nee...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void LoadSymbolFromSchematic(SCH_COMPONENT *aSymbol)
Load a symbol from the schematic to edit in place.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
static TOOL_ACTION newSymbol
Definition: ee_actions.h:169
wxArrayString GetLibraryNames() const
Return the array of library names.
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
Definition: lib_tree.cpp:194
bool LoadSymbolFromCurrentLib(const wxString &aAliasName, int aUnit=0, int aConvert=0)
Load a symbol from the current active library, optionally setting the selected unit and convert.
static TOOL_ACTION saveSymbolAs
Definition: ee_actions.h:168
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
void doCloseWindow() override
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:71
LIB_ID GetTargetLibId() const
static TOOL_ACTION redo
Definition: actions.h:68
const BITMAP_OPAQUE icon_libedit_xpm[1]
COLOR4D GetColor(int aLayer) const
void HideDrawingSheet()
Definition: sch_view.cpp:178
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:96
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
see class PGM_BASE
SYMBOL_EDITOR_SETTINGS * m_settings
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
void OnToggleSearchTree(wxCommandEvent &event)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
bool saveAllLibraries(bool aRequireConfirmation)
Save the current part.
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:197
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
#define _(s)
Definition: 3d_actions.cpp:33
Tool that displays edit points allowing to modify items by dragging the points.
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
void SetNickName(const wxString &aNickName)
Change the logical name of this library, useful for an editor.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:505
void SetOrigin(const Vec &pos)
Definition: box2.h:210
#define EDIT_TOOL(tool)
Handle the component boundary box.
Definition: eda_rect.h:42
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:447
Schematic symbol object.
Definition: sch_symbol.h:78
wxProgressDialog with the option to also update the application progress on the taskbar
static bool empty(const wxTextEntryBase *aCtrl)
wxPoint GetPosition() const override
Definition: sch_symbol.h:680
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
bool isCurrentPart(const LIB_ID &aLibId) const
Rename LIB_PART aliases to avoid conflicts before adding a symbol to a library.
static TOOL_ACTION drawSymbolArc
Definition: ee_actions.h:102
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:167
coord_type GetHeight() const
Definition: box2.h:198
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
bool IsMulti() const
Definition: lib_symbol.h:495
void OnExitKiCad(wxCommandEvent &event)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
Color settings are a bit different than most of the settings objects in that there can be more than o...
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION deleteTool
Definition: actions.h:76
SYMBOL_LIBRARY_MANAGER * m_libMgr
const BITMAP_OPAQUE icon_libedit_32_xpm[1]
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Create an empty library and adds it to the library table.
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:194
int GetConvert() const
Definition: sch_symbol.h:264
static TOOL_ACTION undo
Definition: actions.h:67
void OnGridSettings(wxCommandEvent &event)
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
static TOOL_ACTION saveAll
Definition: actions.h:57
void InitTools()
Initializes all registered tools.
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Definition for part library class.
const Vec & GetOrigin() const
Definition: box2.h:193
bool AddLibraryFile(bool aCreateNew)
Create or add an existing library to the symbol library table.
void SetModify()
Definition: base_screen.h:59
void emptyScreen()
Return either the part selected in the symbol tree, if context menu is active or the currently modifi...
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
LIB_TREE * GetLibTree() const
BASE_SCREEN class implementation.
void SyncLibraries(bool aShowProgress, const wxString &aForceRefresh=wxEmptyString)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
Handle actions for the various symbol editor and viewers.
static constexpr int Millimeter2iu(double mm)
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
bool IsSymbolFromLegacyLibrary() const
virtual void ShowChangedLanguage()
Redraw the menus and what not in current language.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
wxString SetCurLib(const wxString &aLibNickname)
Set the current library nickname and returns the old library nickname.
static TOOL_ACTION selectAll
Definition: actions.h:73
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
static TOOL_ACTION paste
Definition: actions.h:71
#define ENABLE(x)
bool UnitsLocked() const
Check whether part units are interchangeable.
Definition: lib_symbol.h:237
static TOOL_ACTION duplicate
Definition: actions.h:74
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:67
static TOOL_ACTION placeSymbolAnchor
Definition: ee_actions.h:104
void ClearListAndDeleteItems()
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...
static TOOL_ACTION revert
Definition: actions.h:58
static TOOL_ACTION selectionTool
Definition: actions.h:156
static TOOL_ACTION saveLibraryAs
Definition: ee_actions.h:167
wxComboBox * m_unitSelectBox
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:183
SYMBOL_EDITOR_DRAWING_TOOLS.
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:177
bool empty() const
Definition: utf8.h:103
virtual void UpdateMsgPanel()
Redraw the message panel.
const std::string KiCadSymbolLibFileExtension
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184
The symbol library editor main window.