KiCad PCB EDA Suite
viewlib_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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2017 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 
30 #include <fctsys.h>
31 #include <kiface_i.h>
32 #include <pgm_base.h>
33 #include <class_drawpanel.h>
34 #include <msgpanel.h>
35 #include <bitmaps.h>
36 
37 #include <sch_edit_frame.h>
38 #include <eeschema_id.h>
39 #include <general.h>
40 #include <viewlib_frame.h>
41 #include <symbol_lib_table.h>
42 #include <sch_legacy_plugin.h>
43 #include <hotkeys.h>
44 #include <dialog_helpers.h>
45 #include <class_libentry.h>
46 #include <class_library.h>
47 
48 
49 // Save previous component library viewer state.
52 
55 
56 
57 BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
58  // Window events
59  EVT_CLOSE( LIB_VIEW_FRAME::OnCloseWindow )
60  EVT_SIZE( LIB_VIEW_FRAME::OnSize )
61  EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate )
62 
63  // Toolbar events
65  EVT_TOOL( ID_LIBVIEW_NEXT, LIB_VIEW_FRAME::onSelectNextSymbol )
66  EVT_TOOL( ID_LIBVIEW_PREVIOUS, LIB_VIEW_FRAME::onSelectPreviousSymbol )
67  EVT_TOOL( ID_LIBVIEW_VIEWDOC, LIB_VIEW_FRAME::onViewSymbolDocument )
69  LIB_VIEW_FRAME::onSelectSymbolBodyStyle )
70  EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
72 
73  // listbox events
74  EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList )
75  EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList )
76  EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList )
77 
78  // Menu (and/or hotkey) events
79  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
80  EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
81  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
82  EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset )
84 
85  EVT_UPDATE_UI( ID_LIBVIEW_VIEWDOC, LIB_VIEW_FRAME::onUpdateViewDoc )
86  EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton )
87  EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
88  LIB_VIEW_FRAME::onUpdateAlternateBodyStyleButton )
89  EVT_UPDATE_UI( ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, LIB_VIEW_FRAME::OnUpdateElectricalType )
90 
91 END_EVENT_TABLE()
92 
93 
94 /* Note:
95  * LIB_VIEW_FRAME can be created in "modal mode", or as a usual frame.
96  * In modal mode:
97  * a tool to export the selected symbol is shown in the toolbar
98  * the style is wxFRAME_FLOAT_ON_PARENT
99  * Note:
100  * On windows, when the frame with type wxFRAME_FLOAT_ON_PARENT is displayed
101  * its parent frame is sometimes brought to the foreground when closing the
102  * LIB_VIEW_FRAME frame.
103  * If it still happens, it could be better to use wxSTAY_ON_TOP
104  * instead of wxFRAME_FLOAT_ON_PARENT
105  */
106 #ifdef __WINDOWS__
107 #define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT // could be wxSTAY_ON_TOP if issues
108 #else
109 #define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT
110 #endif
111 
112 #define LIB_VIEW_FRAME_NAME "ViewlibFrame"
113 #define LIB_VIEW_FRAME_NAME_MODAL "ViewlibFrameModal"
114 
115 LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
116  const wxString& aLibraryName ) :
117  SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ),
118  wxDefaultPosition, wxDefaultSize,
119  aFrameType == FRAME_SCH_VIEWER_MODAL ?
121  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
123  aFrameType == FRAME_SCH_VIEWER_MODAL ?
125 {
126  wxASSERT( aFrameType == FRAME_SCH_VIEWER ||
127  aFrameType == FRAME_SCH_VIEWER_MODAL );
128 
129  if( aFrameType == FRAME_SCH_VIEWER_MODAL )
130  SetModal( true );
131 
132  // Force the frame name used in config. the lib viewer frame has a name
133  // depending on aFrameType (needed to identify the frame by wxWidgets),
134  // but only one configuration is preferable.
136 
137  // Give an icon
138  wxIcon icon;
139  icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
140  SetIcon( icon );
141 
143  m_cmpList = NULL;
144  m_libList = NULL;
145  m_listPowerCmpOnly = false;
146  SetShowElectricalType( true );
147 
148  SetScreen( new SCH_SCREEN( aKiway ) );
149  GetScreen()->m_Center = true; // Axis origin centered on screen.
150  LoadSettings( config() );
151 
152  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
153 
154  // Initialize grid id to the default value (50 mils):
156  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
157 
158  // Menu bar is not mandatory: uncomment/comment the next line
159  // to add/remove the menubar
160  ReCreateMenuBar();
163 
164  if( aLibraryName.empty() )
165  {
166  // Creates the libraries window display
167  m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
168  wxPoint( 0, 0 ), wxSize( m_libListWidth, -1 ),
169  0, NULL, wxLB_HSCROLL );
170  }
171  else
172  {
173  m_libraryName = aLibraryName;
174  m_entryName.Clear();
175  m_unit = 1;
176  m_convert = 1;
177  m_libListWidth = 0;
178  }
179 
180  m_selection_changed = false;
181 
182  // Creates the component window display
183  m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ),
184  wxSize( m_cmpListWidth, -1 ), 0, NULL, wxLB_HSCROLL );
185 
186  if( m_libList )
187  ReCreateListLib();
188 
189  DisplayLibInfos();
190 
191  m_auimgr.SetManagedWindow( this );
192 
193  EDA_PANEINFO horiz;
194  horiz.HorizontalToolbarPane();
195 
196  EDA_PANEINFO vert;
197  vert.VerticalToolbarPane();
198 
199  EDA_PANEINFO info;
200  info.InfoToolbarPane();
201 
202  EDA_PANEINFO mesg;
203  mesg.MessageToolbarPane();
204 
205 
206  // Manage main toolbar
207  m_auimgr.AddPane( m_mainToolBar,
208  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
209 
210  // Manage the left window (list of libraries)
211  if( m_libList )
212  m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( "m_libList" ).Left().Row( 0 ) );
213 
214  // Manage the list of components)
215  m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( "m_cmpList" ).Left().Row( 1 ) );
216 
217  // Manage the draw panel
218  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
219 
220  // Manage the message panel
221  m_auimgr.AddPane( m_messagePanel,
222  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
223 
224  /* Now the minimum windows are fixed, set library list
225  * and component list of the previous values from last viewlib use
226  */
227  if( m_libList )
228  {
229  m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1 ) );
230  m_auimgr.GetPane( m_libList ).BestSize( wxSize( m_libListWidth, -1 ) );
231  }
232 
233  m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
234  m_auimgr.GetPane( m_cmpList ).BestSize( wxSize( m_cmpListWidth, -1 ) );
235 
236  m_auimgr.Update();
237 
238  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
239 #ifdef USE_WX_GRAPHICS_CONTEXT
241 #else
242  Zoom_Automatique( false );
243 #endif
244 
245  if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
246  {
247  Raise();
248  Show( true );
249  }
250 }
251 
252 
254 {
255 }
256 
257 
258 void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
259 {
260  m_unit = aUnit > 0 ? aUnit : 1;
261  m_convert = aConvert > 0 ? aConvert : 1;
262  m_selection_changed = false;
263 }
264 
265 
267 {
268  LIB_ALIAS* alias = NULL;
269 
270  if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
271  {
272  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
273  }
274 
275  return alias;
276 }
277 
278 
280 {
281  LIB_PART* symbol = NULL;
282  LIB_ALIAS* alias = getSelectedAlias();
283 
284  if( alias )
285  symbol = alias->GetPart();
286 
287  return symbol;
288 }
289 
290 
292 {
293  LIB_PART* symbol = getSelectedSymbol();
294 
295  aEvent.Enable( symbol && symbol->HasConversion() );
296 
297  if( symbol )
298  aEvent.Check( m_convert > 1 );
299  else
300  aEvent.Check( false );
301 }
302 
303 
304 void LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton( wxUpdateUIEvent& aEvent )
305 {
306  LIB_PART* symbol = getSelectedSymbol();
307 
308  aEvent.Enable( symbol && symbol->HasConversion() );
309 
310  if( symbol )
311  aEvent.Check( m_convert <= 1 );
312  else
313  aEvent.Check( true );
314 }
315 
316 
317 void LIB_VIEW_FRAME::onUpdateViewDoc( wxUpdateUIEvent& aEvent )
318 {
319  LIB_ALIAS* alias = getSelectedAlias();
320 
321  aEvent.Enable( alias && !alias->GetDocFileName().IsEmpty() );
322 }
323 
324 
325 void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
326 {
327  if( !IsModal() )
328  {
329  Destroy();
330  }
331  else if( !IsDismissed() )
332  {
333  // only dismiss modal frame if not already dismissed.
334  DismissModal( false );
335 
336  // Modal frame will be destroyed by the calling function.
337  }
338 }
339 
340 
341 void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
342 {
343  if( m_auimgr.GetManagedWindow() )
344  m_auimgr.Update();
345 
346  SizeEv.Skip();
347 }
348 
349 
350 void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
351 {
353  UpdateStatusBar();
354 }
355 
356 
357 void LIB_VIEW_FRAME::OnShowElectricalType( wxCommandEvent& event )
358 {
360  m_canvas->Refresh();
361 }
362 
363 
364 void LIB_VIEW_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
365 {
366  aEvent.Check( GetShowElectricalType() );
367 }
368 
369 
371 {
372  LIB_PART* part = NULL;
373  double defaultLibraryZoom = 7.33;
374 
375  if( m_libraryName.IsEmpty() || m_entryName.IsEmpty() )
376  {
377  SetScrollCenterPosition( wxPoint( 0, 0 ) );
378  return defaultLibraryZoom;
379  }
380 
381  LIB_ALIAS* alias = nullptr;
382 
383  try
384  {
385  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
386  }
387  catch( ... )
388  {
389  }
390 
391  if( alias )
392  part = alias->GetPart();
393 
394  if( !part )
395  {
396  SetScrollCenterPosition( wxPoint( 0, 0 ) );
397  return defaultLibraryZoom;
398  }
399 
401 
402  double sizeX = (double) boundingBox.GetWidth();
403  double sizeY = (double) boundingBox.GetHeight();
404  wxPoint centre = boundingBox.Centre();
405 
406  // Reserve a 20% margin around component bounding box.
407  double margin_scale_factor = 1.2;
408 
409  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
410 }
411 
412 
414 {
415  if( !m_libList )
416  return false;
417 
418  m_libList->Clear();
419 
420  std::vector< wxString > libs = Prj().SchSymbolLibTable()->GetLogicalLibs();
421 
422  // Remove not allowed libs from main list, if the allowed lib list is not empty
423  if( m_allowedLibs.GetCount() )
424  {
425  for( unsigned ii = 0; ii < libs.size(); )
426  {
427  if( m_allowedLibs.Index( libs[ii] ) == wxNOT_FOUND )
428  libs.erase( libs.begin() + ii );
429  else
430  ii++;
431  }
432  }
433 
434  // Remove libs which have no power components, if this filter is activated
435  if( m_listPowerCmpOnly )
436  {
437  for( unsigned ii = 0; ii < libs.size(); )
438  {
439  wxArrayString aliasNames;
440 
441  Prj().SchSymbolLibTable()->EnumerateSymbolLib( libs[ii], aliasNames, true );
442 
443  if( aliasNames.IsEmpty() )
444  libs.erase( libs.begin() + ii );
445  else
446  ii++;
447  }
448  }
449 
450  if( libs.empty() )
451  return true;
452 
453  wxArrayString libNames;
454 
455  for( const auto& name : libs )
456  libNames.Add( name );
457 
458  m_libList->Append( libNames );
459 
460  // Search for a previous selection:
461  int index = m_libList->FindString( m_libraryName );
462 
463  if( index != wxNOT_FOUND )
464  {
465  m_libList->SetSelection( index, true );
466  }
467  else
468  {
469  // If not found, clear current library selection because it can be
470  // deleted after a config change.
471  m_libraryName = libs[0];
472  m_entryName = wxEmptyString;
473  m_unit = 1;
474  m_convert = 1;
475  }
476 
477  bool cmp_changed = ReCreateListCmp();
479  DisplayLibInfos();
480  m_canvas->Refresh();
481 
482  return cmp_changed;
483 }
484 
485 
487 {
488  if( m_cmpList == NULL )
489  return false;
490 
491  m_cmpList->Clear();
492 
493  wxArrayString aliasNames;
494 
495  try
496  {
497  Prj().SchSymbolLibTable()->EnumerateSymbolLib( m_libraryName, aliasNames,
499  }
500  catch( const IO_ERROR& e ) {} // ignore, it is handled below
501 
502  if( aliasNames.IsEmpty() )
503  {
504  m_libraryName = wxEmptyString;
505  m_entryName = wxEmptyString;
506  m_convert = 1;
507  m_unit = 1;
508  return true;
509  }
510 
511  m_cmpList->Append( aliasNames );
512 
513  int index = m_cmpList->FindString( m_entryName );
514  bool changed = false;
515 
516  if( index == wxNOT_FOUND )
517  {
518  // Select the first library entry when the previous entry name does not exist in
519  // the current library.
520  m_convert = 1;
521  m_unit = 1;
522  index = 0;
523  changed = true;
524  m_entryName = wxEmptyString;
525  }
526 
527  m_cmpList->SetSelection( index, true );
528 
529  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
530  ProcessEvent( evt );
531 
532  return changed;
533 }
534 
535 
536 void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
537 {
538  int ii = m_libList->GetSelection();
539 
540  if( ii < 0 )
541  return;
542 
543  m_selection_changed = true;
544 
545  SetSelectedLibrary( m_libList->GetString( ii ) );
546 }
547 
548 
549 void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
550 {
551  if( m_libraryName == aLibraryName )
552  return;
553 
554  m_libraryName = aLibraryName;
555  ReCreateListCmp();
556  m_canvas->Refresh();
557  DisplayLibInfos();
559 
560  // Ensure the corresponding line in m_libList is selected
561  // (which is not necessary the case if SetSelectedLibrary is called
562  // by an other caller than ClickOnLibList.
563  m_libList->SetStringSelection( m_libraryName, true );
564 }
565 
566 
567 void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
568 {
569  int ii = m_cmpList->GetSelection();
570 
571  if( ii < 0 )
572  return;
573 
574  m_selection_changed = true;
575 
576  SetSelectedComponent( m_cmpList->GetString( ii ) );
577 }
578 
579 
580 void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
581 {
582  // Aren't component names case sensitive now?
583  if( m_entryName.CmpNoCase( aComponentName ) != 0 )
584  {
585  m_entryName = aComponentName;
586 
587  // Ensure the corresponding line in m_cmpList is selected
588  // (which is not necessarily the case if SetSelectedComponent is called
589  // by another caller than ClickOnCmpList.
590  m_cmpList->SetStringSelection( aComponentName, true );
591  DisplayLibInfos();
592 
593  if( m_selection_changed )
594  {
595  m_unit = 1;
596  m_convert = 1;
597  m_selection_changed = false;
598  }
599 
600  Zoom_Automatique( false );
602  m_canvas->Refresh();
603  }
604 }
605 
606 
607 void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
608 {
609  if( IsModal() )
610  {
612 
613  // The schematic editor might not be the parent of the library viewer.
614  // It could be a python window.
615  SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
616 
617  if( schframe )
618  {
619  // Prevent the double click from being as a single click in the parent
620  // window which would cause the part to be parked rather than staying
621  // in drag mode.
622  schframe->SkipNextLeftButtonReleaseEvent();
623  }
624  }
625 }
626 
627 
628 void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
629 {
630  int ii = m_cmpList->GetSelection();
631 
632  if( ii >= 0 )
633  {
634  wxString part_name = m_libraryName + ':' + m_cmpList->GetString( ii );
635 
636  // a selection was made, pass true
637  DismissModal( true, part_name );
638  }
639  else
640  {
641  // no selection was made, pass false
642  DismissModal( false );
643  }
644 
645  Close( true );
646 }
647 
648 
649 #define LIBLIST_WIDTH_KEY "ViewLiblistWidth"
650 #define CMPLIST_WIDTH_KEY "ViewCmplistWidth"
651 #define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY "ViewCmpShowPinElectricalType"
652 
653 // Currently, the library viewer has no dialog to change the background color
654 // of the draw canvas. Therefore the background color is here just
655 // in case of this option is added to some library viewer config dialog
656 #define LIBVIEW_BGCOLOR "LibviewBgColor"
657 
658 
659 void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
660 {
662 
665 
666  aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
667  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
668  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
670 
671  // Set parameters to a reasonable value.
672  if( m_libListWidth > m_FrameSize.x/2 )
674 
675  if( m_cmpListWidth > m_FrameSize.x/2 )
677 }
678 
679 
680 void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
681 {
683 
684  if( m_libListWidth && m_libList )
685  {
686  m_libListWidth = m_libList->GetSize().x;
687  aCfg->Write( LIBLIST_WIDTH_KEY, m_libListWidth );
688  }
689 
690  m_cmpListWidth = m_cmpList->GetSize().x;
691  aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth );
692 
694 }
695 
696 
697 void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
698 {
700 
701  bool changed = m_libList ? ReCreateListLib() : false;
702 
703  if (changed)
704  m_selection_changed = true;
705 
706  DisplayLibInfos();
707 }
708 
709 
710 void LIB_VIEW_FRAME::CloseLibraryViewer( wxCommandEvent& event )
711 {
712  Close();
713 }
714 
715 
717 {
718  m_listPowerCmpOnly = false;
719  m_allowedLibs.Clear();
720 
721  if( aFilter )
722  {
723  m_allowedLibs = aFilter->GetAllowedLibList();
725  }
726 
727  ReCreateListLib();
728 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
static int m_unit
static int m_convert
void SetFilter(const SCHLIB_FILTER *aFilter)
Set a filter to display only libraries and/or components which match the filter.
static wxString m_entryName
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Part library alias object definition.
#define LIB_VIEW_FRAME_NAME
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1...
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing...
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
bool IsDismissed()
Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been...
void onUpdateViewDoc(wxUpdateUIEvent &aEvent)
virtual void OnActivate(wxActivateEvent &event) override
Called when the frame is activated to reload the libraries and component lists that can be changed by...
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
Definition: zoom.cpp:86
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:150
void SetScrollCenterPosition(const wxPoint &aPoint)
void OnCloseWindow(wxCloseEvent &Event)
void SetShowElectricalType(bool aShow)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int GetHeight() const
Definition: eda_rect.h:118
wxListBox * m_cmpList
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
wxArrayString m_allowedLibs
Schematic editor (Eeschema) main window.
wxAuiManager m_auimgr
static wxString m_libraryName
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:289
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:514
#define LIBLIST_WIDTH_KEY
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
LIB_ALIAS * getSelectedAlias()
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:751
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Symbol library viewer main window.
Definition: viewlib_frame.h:49
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::Process_Config EDA_BASE_FRAME::OnSelectPreferredEditor EVT_COMBOBOX(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnSelectActiveLayer) EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE
EVT_TOOL(ID_MODVIEW_SELECT_LIB, FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary) EVT_TOOL(ID_MODVIEW_SELECT_PART
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
LIB_VIEW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aLibraryName=wxEmptyString)
Constructor.
const wxArrayString & GetAllowedLibList() const
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
bool m_Center
Center on screen.
Definition: base_screen.h:202
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
Class LIB_ITEM definition.
void SetScalingFactor(double iu_per_du)
Function SetScalingFactor sets the scaling factor of "internal unit per device unit".
Definition: base_screen.cpp:99
void CloseLibraryViewer(wxCommandEvent &event)
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser) EVT_MENU_RANGE(ID_LANGUAGE_CHOICE
LIB_PART * getSelectedSymbol()
Define a library symbol object.
Helper dialog and control classes.
void ReCreateHToolbar() override
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
bool GetFilterPowerParts() const
void OnSetRelativeOffset(wxCommandEvent &event)
wxPoint Centre() const
Definition: eda_rect.h:60
bool IsModal()
Definition: kiway_player.h:229
int m_LastGridSizeId
Definition: draw_frame.h:78
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
bool ReCreateListCmp()
Create or recreate the list of components in the currently selected library.
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
void ExportToSchematicLibraryPart(wxCommandEvent &event)
Function ExportToSchematicLibraryPart exports the current component to schematic and close the librar...
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:719
void DisplayLibInfos()
Definition: viewlibs.cpp:171
void SetModal(bool aIsModal)
Definition: kiway_player.h:230
EVT_TOOL_RANGE(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onSelectSymbolBodyStyle) EVT_UPDATE_UI(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT
LIB_PART * GetPart() const
Get the shared LIB_PART.
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void ClickOnLibList(wxCommandEvent &event)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY
wxString GetDocFileName() const
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
see class PGM_BASE
void onUpdateNormalBodyStyleButton(wxUpdateUIEvent &aEvent)
const char * name
Definition: DXF_plotter.cpp:61
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
void OnUpdateElectricalType(wxUpdateUIEvent &aEvent)
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
KICAD_MANAGER_FRAME::language_change KICAD_MANAGER_FRAME::OnChangeIconsOptions EVT_UPDATE_UI(ID_SELECT_PREFERED_PDF_BROWSER, KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser) EVT_UPDATE_UI_RANGE(ID_TO_SCH
wxListBox * m_libList
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void onUpdateAlternateBodyStyleButton(wxUpdateUIEvent &aEvent)
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void ClickOnCmpList(wxCommandEvent &event)
#define MODAL_MODE_EXTRASTYLE
int GetWidth() const
Definition: eda_rect.h:117
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void SetDrawBgColor(COLOR4D aColor) override
double BestZoom() override
Return the zoom level which displays the full page on screen.
void ReCreateVToolbar() override
bool GetShowElectricalType()
#define LIB_VIEW_FRAME_NAME_MODAL
Definition for part library class.
void OnShowElectricalType(wxCommandEvent &event)
void DClickOnCmpList(wxCommandEvent &event)
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
Message panel definition file.
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a common way of handling the provided virtual functions for the derived classes.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
virtual void OnActivate(wxActivateEvent &event)
Function OnActivate (virtual) is called when activating the frame.
Definition: draw_frame.cpp:271
#define CMPLIST_WIDTH_KEY
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
void SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
void OnSize(wxSizeEvent &event) override
Function OnSize recalculates the size of toolbars and display panel when the frame size changes...