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-2016 Wayne Stambaugh <stambaughw@verizon.net>
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 <eeschema_id.h>
34 #include <class_drawpanel.h>
35 #include <schframe.h>
36 #include <msgpanel.h>
37 #include <bitmaps.h>
38 
39 #include <general.h>
40 #include <viewlib_frame.h>
41 #include <class_library.h>
42 #include <hotkeys.h>
43 #include <dialog_helpers.h>
44 
45 
46 // Save previous component library viewer state.
49 
52 
53 
54 BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
55  // Window events
56  EVT_CLOSE( LIB_VIEW_FRAME::OnCloseWindow )
57  EVT_SIZE( LIB_VIEW_FRAME::OnSize )
58  EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate )
59 
60  // Toolbar events
62  EVT_TOOL( ID_LIBVIEW_NEXT, LIB_VIEW_FRAME::onSelectNextSymbol )
63  EVT_TOOL( ID_LIBVIEW_PREVIOUS, LIB_VIEW_FRAME::onSelectPreviousSymbol )
64  EVT_TOOL( ID_LIBVIEW_VIEWDOC, LIB_VIEW_FRAME::onViewSymbolDocument )
66  LIB_VIEW_FRAME::onSelectSymbolBodyStyle )
67  EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
68  EVT_COMBOBOX( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::onSelectSymbolUnit )
69 
70  // listbox events
71  EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList )
72  EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList )
73  EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList )
74 
75  // Menu (and/or hotkey) events
76  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
77  EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
78  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
79  EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset )
81 
82  EVT_UPDATE_UI( ID_LIBVIEW_VIEWDOC, LIB_VIEW_FRAME::onUpdateViewDoc )
83  EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton )
84  EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onUpdateAlternateBodyStyleButton )
85  EVT_UPDATE_UI( ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, LIB_VIEW_FRAME::OnUpdateElectricalType )
86 
87 END_EVENT_TABLE()
88 
89 
90 /* Note:
91  * LIB_VIEW_FRAME can be created in "modal mode", or as a usual frame.
92  * In modal mode:
93  * a tool to export the selected symbol is shown in the toolbar
94  * the style is wxFRAME_FLOAT_ON_PARENT
95  * Note:
96  * On windows, when the frame with type wxFRAME_FLOAT_ON_PARENT is displayed
97  * its parent frame is sometimes brought to the foreground when closing the
98  * LIB_VIEW_FRAME frame.
99  * If it still happens, it could be better to use wxSTAY_ON_TOP
100  * instead of wxFRAME_FLOAT_ON_PARENT
101  */
102 #ifdef __WINDOWS__
103 #define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT // could be wxSTAY_ON_TOP if issues
104 #else
105 #define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT
106 #endif
107 
108 #define LIB_VIEW_FRAME_NAME "ViewlibFrame"
109 #define LIB_VIEW_FRAME_NAME_MODAL "ViewlibFrameModal"
110 
111 LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
112  PART_LIB* aLibrary ) :
113  SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ),
114  wxDefaultPosition, wxDefaultSize,
115  aFrameType == FRAME_SCH_VIEWER_MODAL ?
117  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
119  aFrameType == FRAME_SCH_VIEWER_MODAL ?
121 {
122  wxASSERT( aFrameType == FRAME_SCH_VIEWER ||
123  aFrameType == FRAME_SCH_VIEWER_MODAL );
124 
125  if( aFrameType == FRAME_SCH_VIEWER_MODAL )
126  SetModal( true );
127 
128  // Force the frame name used in config. the lib viewer frame has a name
129  // depending on aFrameType (needed to identify the frame by wxWidgets),
130  // but only one configuration is preferable.
131  m_configFrameName = LIB_VIEW_FRAME_NAME;
132 
133  // Give an icon
134  wxIcon icon;
135  icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
136  SetIcon( icon );
137 
138  m_hotkeysDescrList = g_Viewlib_Hokeys_Descr;
139  m_cmpList = NULL;
140  m_libList = NULL;
141  m_listPowerCmpOnly = false;
142  SetShowElectricalType( true );
143 
144  SetScreen( new SCH_SCREEN( aKiway ) );
145  GetScreen()->m_Center = true; // Axis origin centered on screen.
146  LoadSettings( config() );
147 
148  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
149 
150  // Initialize grid id to the default value (50 mils):
152  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
153 
154  // Menu bar is not mandatory: uncomment/comment the next line
155  // to add/remove the menubar
156  ReCreateMenuBar();
157  ReCreateHToolbar();
158  ReCreateVToolbar();
159 
160  if( !aLibrary )
161  {
162  // Creates the libraries window display
163  m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
164  wxPoint( 0, 0 ), wxSize( m_libListWidth, -1 ),
165  0, NULL, wxLB_HSCROLL );
166  }
167  else
168  {
169  m_libraryName = aLibrary->GetName();
170  m_entryName.Clear();
171  m_unit = 1;
172  m_convert = 1;
173  m_libListWidth = 0;
174  }
175 
176  m_selection_changed = false;
177 
178  // Creates the component window display
179  m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ),
180  wxSize( m_cmpListWidth, -1 ), 0, NULL, wxLB_HSCROLL );
181 
182  if( m_libList )
183  ReCreateListLib();
184 
185  DisplayLibInfos();
186 
187  m_auimgr.SetManagedWindow( this );
188 
189  EDA_PANEINFO horiz;
190  horiz.HorizontalToolbarPane();
191 
192  EDA_PANEINFO vert;
193  vert.VerticalToolbarPane();
194 
195  EDA_PANEINFO info;
196  info.InfoToolbarPane();
197 
198  EDA_PANEINFO mesg;
199  mesg.MessageToolbarPane();
200 
201 
202  // Manage main toolbar
203  m_auimgr.AddPane( m_mainToolBar,
204  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
205 
206  // Manage the left window (list of libraries)
207  if( m_libList )
208  m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( "m_libList" ).Left().Row( 0 ) );
209 
210  // Manage the list of components)
211  m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( "m_cmpList" ).Left().Row( 1 ) );
212 
213  // Manage the draw panel
214  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
215 
216  // Manage the message panel
217  m_auimgr.AddPane( m_messagePanel,
218  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
219 
220  /* Now the minimum windows are fixed, set library list
221  * and component list of the previous values from last viewlib use
222  */
223  if( m_libList )
224  {
225  m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1 ) );
226  m_auimgr.GetPane( m_libList ).BestSize( wxSize( m_libListWidth, -1 ) );
227  }
228 
229  m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
230  m_auimgr.GetPane( m_cmpList ).BestSize( wxSize( m_cmpListWidth, -1 ) );
231 
232  m_auimgr.Update();
233 
234  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
235 #ifdef USE_WX_GRAPHICS_CONTEXT
236  GetScreen()->SetZoom( BestZoom() );
237 #else
238  Zoom_Automatique( false );
239 #endif
240 
241  if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
242  {
243  Raise();
244  Show( true );
245  }
246 }
247 
248 
250 {
251 }
252 
253 
254 void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
255 {
256  m_unit = aUnit > 0 ? aUnit : 1;
257  m_convert = aConvert > 0 ? aConvert : 1;
258  m_selection_changed = false;
259 }
260 
261 
263 {
264  LIB_ALIAS* alias = NULL;
265 
266  if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
267  {
268  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
269 
270  if( lib )
271  alias = lib->FindAlias( m_entryName );
272  }
273 
274  return alias;
275 }
276 
277 
279 {
280  LIB_PART* symbol = NULL;
281  LIB_ALIAS* alias = getSelectedAlias();
282 
283  if( alias )
284  symbol = alias->GetPart();
285 
286  return symbol;
287 }
288 
289 
291 {
292  LIB_PART* symbol = getSelectedSymbol();
293 
294  aEvent.Enable( symbol && symbol->HasConversion() );
295 
296  if( symbol )
297  aEvent.Check( m_convert > 1 );
298  else
299  aEvent.Check( false );
300 }
301 
302 
303 void LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton( wxUpdateUIEvent& aEvent )
304 {
305  LIB_PART* symbol = getSelectedSymbol();
306 
307  aEvent.Enable( symbol && symbol->HasConversion() );
308 
309  if( symbol )
310  aEvent.Check( m_convert <= 1 );
311  else
312  aEvent.Check( true );
313 }
314 
315 
316 void LIB_VIEW_FRAME::onUpdateViewDoc( wxUpdateUIEvent& aEvent )
317 {
318  LIB_ALIAS* alias = getSelectedAlias();
319 
320  aEvent.Enable( alias && !alias->GetDocFileName().IsEmpty() );
321 }
322 
323 
324 void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
325 {
326  if( !IsModal() )
327  {
328  Destroy();
329  }
330  else if( !IsDismissed() )
331  {
332  // only dismiss modal frame if not already dismissed.
333  DismissModal( false );
334 
335  // Modal frame will be destroyed by the calling function.
336  }
337 }
338 
339 
340 void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
341 {
342  if( m_auimgr.GetManagedWindow() )
343  m_auimgr.Update();
344 
345  SizeEv.Skip();
346 }
347 
348 
349 void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
350 {
352  UpdateStatusBar();
353 }
354 
355 
356 void LIB_VIEW_FRAME::OnShowElectricalType( wxCommandEvent& event )
357 {
359  m_canvas->Refresh();
360 }
361 
362 
363 void LIB_VIEW_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
364 {
365  aEvent.Check( GetShowElectricalType() );
366 }
367 
369 {
370  /* Please, note: wxMSW before version 2.9 seems have
371  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
372  * edit file <wxWidgets>/src/msw/dc.cpp
373  * search for line static const int VIEWPORT_EXTENT = 1000;
374  * and replace by static const int VIEWPORT_EXTENT = 10000;
375  */
376 
377  LIB_PART* part = NULL;
378  double bestzoom = 16.0; // default value for bestzoom
379  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
380 
381  if( lib )
382  part = lib->FindPart( m_entryName );
383 
384  if( !part )
385  {
386  SetScrollCenterPosition( wxPoint( 0, 0 ) );
387  return bestzoom;
388  }
389 
390  wxSize size = m_canvas->GetClientSize();
391 
393 
394  // Reserve a 10% margin around component bounding box.
395  double margin_scale_factor = 0.8;
396  double zx =(double) boundingBox.GetWidth() /
397  ( margin_scale_factor * (double)size.x );
398  double zy = (double) boundingBox.GetHeight() /
399  ( margin_scale_factor * (double)size.y);
400 
401  // Calculates the best zoom
402  bestzoom = std::max( zx, zy );
403 
404  // keep it >= minimal existing zoom (can happen for very small components
405  // like small power symbols
406  if( bestzoom < GetScreen()->m_ZoomList[0] )
407  bestzoom = GetScreen()->m_ZoomList[0];
408 
409  SetScrollCenterPosition( boundingBox.Centre() );
410 
411  return bestzoom;
412 }
413 
414 
416 {
417  if( !m_libList )
418  return false;
419 
420  m_libList->Clear();
421 
422  wxArrayString libs = Prj().SchLibs()->GetLibraryNames();
423 
424  // Remove not allowed libs from main list, if the allowed lib list is not empty
425  if( m_allowedLibs.GetCount() )
426  {
427  for( unsigned ii = 0; ii < libs.GetCount(); )
428  {
429  if( m_allowedLibs.Index( libs[ii] ) == wxNOT_FOUND )
430  libs.RemoveAt( ii );
431  else
432  ii++;
433  }
434  }
435 
436  // Remove libs which have no power components, if this filter is activated
437  if( m_listPowerCmpOnly )
438  {
439  for( unsigned ii = 0; ii < libs.GetCount(); )
440  {
441  PART_LIB* lib = Prj().SchLibs()->FindLibrary( libs[ii] );
442 
443  if( lib && !lib->HasPowerParts() )
444  libs.RemoveAt( ii );
445  else
446  ii++;
447  }
448  }
449 
450  if( libs.IsEmpty() )
451  return true;
452 
453  m_libList->Append( libs );
454 
455  // Search for a previous selection:
456  int index = m_libList->FindString( m_libraryName );
457 
458  if( index != wxNOT_FOUND )
459  {
460  m_libList->SetSelection( index, true );
461  }
462  else
463  {
464  // If not found, clear current library selection because it can be
465  // deleted after a config change.
466  m_libraryName = libs[0];
467  m_entryName = wxEmptyString;
468  m_unit = 1;
469  m_convert = 1;
470  }
471 
472  bool cmp_changed = ReCreateListCmp();
474  DisplayLibInfos();
475  m_canvas->Refresh();
476 
477  return cmp_changed;
478 }
479 
480 
482 {
483  if( m_cmpList == NULL )
484  return false;
485 
486  m_cmpList->Clear();
487 
488  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
489 
490  if( !lib || lib->IsEmpty() )
491  {
492  m_libraryName = wxEmptyString;
493  m_entryName = wxEmptyString;
494  m_convert = 1;
495  m_unit = 1;
496  return true;
497  }
498 
499  wxArrayString nameList;
500 
501  if( m_listPowerCmpOnly )
502  lib->GetEntryTypePowerNames( nameList );
503  else
504  lib->GetAliasNames( nameList );
505 
506  m_cmpList->Append( nameList );
507 
508  int index = m_cmpList->FindString( m_entryName );
509  bool changed = false;
510 
511  if( index == wxNOT_FOUND )
512  {
513  // Select the first library entry when the previous entry name does not exist in
514  // the current library.
515  m_convert = 1;
516  m_unit = 1;
517  index = 0;
518  changed = true;
519  m_entryName = wxEmptyString;
520  }
521 
522  m_cmpList->SetSelection( index, true );
523 
524  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
525  ProcessEvent( evt );
526 
527  return changed;
528 }
529 
530 
531 void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
532 {
533  int ii = m_libList->GetSelection();
534 
535  if( ii < 0 )
536  return;
537 
538  m_selection_changed = true;
539 
540  SetSelectedLibrary( m_libList->GetString( ii ) );
541 }
542 
543 
544 void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
545 {
546  if( m_libraryName == aLibraryName )
547  return;
548 
549  m_libraryName = aLibraryName;
550  ReCreateListCmp();
551  m_canvas->Refresh();
552  DisplayLibInfos();
554 
555  // Ensure the corresponding line in m_libList is selected
556  // (which is not necessary the case if SetSelectedLibrary is called
557  // by an other caller than ClickOnLibList.
558  m_libList->SetStringSelection( m_libraryName, true );
559 }
560 
561 
562 void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
563 {
564  int ii = m_cmpList->GetSelection();
565 
566  if( ii < 0 )
567  return;
568 
569  m_selection_changed = true;
570 
571  SetSelectedComponent( m_cmpList->GetString( ii ) );
572 }
573 
574 
575 void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
576 {
577  // Aren't component names case sensitive now?
578  if( m_entryName.CmpNoCase( aComponentName ) != 0 )
579  {
580  m_entryName = aComponentName;
581 
582  // Ensure the corresponding line in m_cmpList is selected
583  // (which is not necessarily the case if SetSelectedComponent is called
584  // by another caller than ClickOnCmpList.
585  m_cmpList->SetStringSelection( aComponentName, true );
586  DisplayLibInfos();
587 
588  if( m_selection_changed )
589  {
590  m_unit = 1;
591  m_convert = 1;
592  m_selection_changed = false;
593  }
594 
595  Zoom_Automatique( false );
597  m_canvas->Refresh();
598  }
599 }
600 
601 
602 void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
603 {
604  if( IsModal() )
605  {
607 
608  // The schematic editor might not be the parent of the library viewer.
609  // It could be a python window.
610  SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
611 
612  if( schframe )
613  {
614  // Prevent the double click from being as a single click in the parent
615  // window which would cause the part to be parked rather than staying
616  // in drag mode.
617  schframe->SkipNextLeftButtonReleaseEvent();
618  }
619  }
620 }
621 
622 
623 void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
624 {
625  int ii = m_cmpList->GetSelection();
626 
627  if( ii >= 0 )
628  {
629  wxString part_name = m_cmpList->GetString( ii );
630 
631  // a selection was made, pass true
632  DismissModal( true, part_name );
633  }
634  else
635  {
636  // no selection was made, pass false
637  DismissModal( false );
638  }
639 
640  Close( true );
641 }
642 
643 
644 #define LIBLIST_WIDTH_KEY "ViewLiblistWidth"
645 #define CMPLIST_WIDTH_KEY "ViewCmplistWidth"
646 #define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY "ViewCmpShowPinElectricalType"
647 
648 // Currently, the library viewer has no dialog to change the background color
649 // of the draw canvas. Therefore the background color is here just
650 // in case of this option is added to some library viewer config dialog
651 #define LIBVIEW_BGCOLOR "LibviewBgColor"
652 
653 
654 void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
655 {
657 
660 
661  aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
662  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
663  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
665 
666  // Set parameters to a reasonable value.
667  if( m_libListWidth > m_FrameSize.x/2 )
669 
670  if( m_cmpListWidth > m_FrameSize.x/2 )
672 }
673 
674 
675 void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
676 {
678 
679  if( m_libListWidth && m_libList )
680  {
681  m_libListWidth = m_libList->GetSize().x;
682  aCfg->Write( LIBLIST_WIDTH_KEY, m_libListWidth );
683  }
684 
685  m_cmpListWidth = m_cmpList->GetSize().x;
686  aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth );
687 
689 }
690 
691 
692 void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
693 {
695 
696  bool changed = m_libList ? ReCreateListLib() : false;
697 
698  if (changed)
699  m_selection_changed = true;
700 
701  DisplayLibInfos();
702 }
703 
704 
705 void LIB_VIEW_FRAME::CloseLibraryViewer( wxCommandEvent& event )
706 {
707  Close();
708 }
709 
710 
712 {
713  m_listPowerCmpOnly = false;
714  m_allowedLibs.Clear();
715 
716  if( aFilter )
717  {
718  m_allowedLibs = aFilter->GetAllowedLibList();
720  }
721 
722  ReCreateListLib();
723 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:475
static int m_unit
bool HasPowerParts()
Function HasPowerParts.
static int m_convert
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
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
Function GetBoundingBox.
Part library alias object definition.
void GetAliasNames(wxArrayString &aNames)
Load a string array with the names of all the entries in this library.
#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
Definition: draw_panel.cpp:326
void GetEntryTypePowerNames(wxArrayString &aNames)
Load a string array with the names of entries of type POWER in this library.
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
Function OnActivate is called when the frame frame is activate to reload the libraries and component ...
EVT_TOOL_RANGE(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onSelectSymbolBodyStyle) LIB_VIEW_FRAME
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 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
wxListBox * m_cmpList
LIB_VIEW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, PART_LIB *aLibrary=NULL)
Constructor.
wxArrayString m_allowedLibs
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
wxAuiManager m_auimgr
Definition: wxstruct.h:140
static wxString m_libraryName
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:275
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:457
#define LIBLIST_WIDTH_KEY
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
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.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:735
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:466
Component library viewer main window.
Definition: viewlib_frame.h:49
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser) EVT_MENU_RANGE(ID_PREFERENCES_HOTKEY_START
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI(ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected) EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD
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:36
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:77
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:493
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
const wxArrayString & GetAllowedLibList() const
Function GetAllowedLibList.
void CloseLibraryViewer(wxCommandEvent &event)
const wxString GetName() const
Return the file name without path or extension.
LIB_PART * getSelectedSymbol()
Class LIB_PART defines a library part 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:257
bool GetFilterPowerParts() const
Function GetFilterPowerParts.
void OnSetRelativeOffset(wxCommandEvent &event)
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
wxPoint Centre() const
bool IsModal()
Definition: kiway_player.h:216
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
Definition: wxstruct.h:540
bool ReCreateListCmp()
Create or recreate the list of components in the currently selected library.
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:705
void DisplayLibInfos()
Definition: viewlibs.cpp:172
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void ClickOnLibList(wxCommandEvent &event)
bool IsEmpty() const
Get library entry status.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#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.
Definition: wxstruct.h:512
see class PGM_BASE
void onUpdateNormalBodyStyleButton(wxUpdateUIEvent &aEvent)
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
#define max(a, b)
Definition: auxiliary.h:86
void OnUpdateElectricalType(wxUpdateUIEvent &aEvent)
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
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.
void ClickOnCmpList(wxCommandEvent &event)
#define MODAL_MODE_EXTRASTYLE
int GetWidth() const
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.
bool GetShowElectricalType()
#define LIB_VIEW_FRAME_NAME_MODAL
wxSize m_FrameSize
Definition: wxstruct.h:131
Definition for part library class.
void OnShowElectricalType(wxCommandEvent &event)
void DClickOnCmpList(wxCommandEvent &event)
Message panel definition file.
bool ReCreateListLib()
Function ReCreateListLib.
Class SCH_BASE_FRAME is a shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRA...
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
virtual void OnActivate(wxActivateEvent &event)
Function OnActivate (virtual) is called when activating the frame.
Definition: draw_frame.cpp:257
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
#define CMPLIST_WIDTH_KEY
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
Definition: basicframe.cpp:166
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
LIB_PART * FindPart(const wxString &aName)
Find part by aName.
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...