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-2016 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  // Creates the component window display
177  m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ),
178  wxSize( m_cmpListWidth, -1 ), 0, NULL, wxLB_HSCROLL );
179 
180  if( m_libList )
181  ReCreateListLib();
182 
183  DisplayLibInfos();
184 
185  m_auimgr.SetManagedWindow( this );
186 
187  EDA_PANEINFO horiz;
188  horiz.HorizontalToolbarPane();
189 
190  EDA_PANEINFO vert;
191  vert.VerticalToolbarPane();
192 
193  EDA_PANEINFO info;
194  info.InfoToolbarPane();
195 
196  EDA_PANEINFO mesg;
197  mesg.MessageToolbarPane();
198 
199 
200  // Manage main toolbal
201  m_auimgr.AddPane( m_mainToolBar,
202  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
203 
204  // Manage the left window (list of libraries)
205  if( m_libList )
206  m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( "m_libList" ).Left().Row( 0 ) );
207 
208  // Manage the list of components)
209  m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( "m_cmpList" ).Left().Row( 1 ) );
210 
211  // Manage the draw panel
212  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
213 
214  // Manage the message panel
215  m_auimgr.AddPane( m_messagePanel,
216  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
217 
218  /* Now the minimum windows are fixed, set library list
219  * and component list of the previous values from last viewlib use
220  */
221  if( m_libList )
222  {
223  m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1 ) );
224  m_auimgr.GetPane( m_libList ).BestSize( wxSize( m_libListWidth, -1 ) );
225  }
226 
227  m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
228  m_auimgr.GetPane( m_cmpList ).BestSize( wxSize( m_cmpListWidth, -1 ) );
229 
230  m_auimgr.Update();
231 
232  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
233 #ifdef USE_WX_GRAPHICS_CONTEXT
234  GetScreen()->SetZoom( BestZoom() );
235 #else
236  Zoom_Automatique( false );
237 #endif
238 
239  if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
240  {
241  Raise();
242  Show( true );
243  }
244 }
245 
246 
248 {
249 }
250 
251 
253 {
254  LIB_ALIAS* alias = NULL;
255 
256  if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
257  {
258  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
259 
260  if( lib )
261  alias = lib->FindAlias( m_entryName );
262  }
263 
264  return alias;
265 }
266 
267 
269 {
270  LIB_PART* symbol = NULL;
271  LIB_ALIAS* alias = getSelectedAlias();
272 
273  if( alias )
274  symbol = alias->GetPart();
275 
276  return symbol;
277 }
278 
279 
281 {
282  LIB_PART* symbol = getSelectedSymbol();
283 
284  aEvent.Enable( symbol && symbol->HasConversion() );
285 
286  if( symbol )
287  aEvent.Check( m_convert > 1 );
288  else
289  aEvent.Check( false );
290 }
291 
292 
293 void LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton( wxUpdateUIEvent& aEvent )
294 {
295  LIB_PART* symbol = getSelectedSymbol();
296 
297  aEvent.Enable( symbol && symbol->HasConversion() );
298 
299  if( symbol )
300  aEvent.Check( m_convert <= 1 );
301  else
302  aEvent.Check( true );
303 }
304 
305 
306 void LIB_VIEW_FRAME::onUpdateViewDoc( wxUpdateUIEvent& aEvent )
307 {
308  LIB_ALIAS* alias = getSelectedAlias();
309 
310  aEvent.Enable( alias && !alias->GetDocFileName().IsEmpty() );
311 }
312 
313 
314 void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
315 {
316  if( !IsModal() )
317  {
318  Destroy();
319  }
320  else if( !IsDismissed() )
321  {
322  // only dismiss modal frame if not already dismissed.
323  DismissModal( false );
324 
325  // Modal frame will be destroyed by the calling function.
326  }
327 }
328 
329 
330 void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
331 {
332  if( m_auimgr.GetManagedWindow() )
333  m_auimgr.Update();
334 
335  SizeEv.Skip();
336 }
337 
338 
339 void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
340 {
342  UpdateStatusBar();
343 }
344 
345 
346 void LIB_VIEW_FRAME::OnShowElectricalType( wxCommandEvent& event )
347 {
349  m_canvas->Refresh();
350 }
351 
352 
353 void LIB_VIEW_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
354 {
355  aEvent.Check( GetShowElectricalType() );
356 }
357 
359 {
360  /* Please, note: wxMSW before version 2.9 seems have
361  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
362  * edit file <wxWidgets>/src/msw/dc.cpp
363  * search for line static const int VIEWPORT_EXTENT = 1000;
364  * and replace by static const int VIEWPORT_EXTENT = 10000;
365  */
366 
367  LIB_PART* part = NULL;
368  double bestzoom = 16.0; // default value for bestzoom
369  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
370 
371  if( lib )
372  part = lib->FindPart( m_entryName );
373 
374  if( !part )
375  {
376  SetScrollCenterPosition( wxPoint( 0, 0 ) );
377  return bestzoom;
378  }
379 
380  wxSize size = m_canvas->GetClientSize();
381 
383 
384  // Reserve a 10% margin around component bounding box.
385  double margin_scale_factor = 0.8;
386  double zx =(double) boundingBox.GetWidth() /
387  ( margin_scale_factor * (double)size.x );
388  double zy = (double) boundingBox.GetHeight() /
389  ( margin_scale_factor * (double)size.y);
390 
391  // Calculates the best zoom
392  bestzoom = std::max( zx, zy );
393 
394  // keep it >= minimal existing zoom (can happen for very small components
395  // like small power symbols
396  if( bestzoom < GetScreen()->m_ZoomList[0] )
397  bestzoom = GetScreen()->m_ZoomList[0];
398 
399  SetScrollCenterPosition( boundingBox.Centre() );
400 
401  return bestzoom;
402 }
403 
404 
406 {
407  if( !m_libList )
408  return;
409 
410  m_libList->Clear();
411 
412  wxArrayString libs = Prj().SchLibs()->GetLibraryNames();
413 
414  // Remove not allowed libs from main list, if the allowed lib list is not empty
415  if( m_allowedLibs.GetCount() )
416  {
417  for( unsigned ii = 0; ii < libs.GetCount(); )
418  {
419  if( m_allowedLibs.Index( libs[ii] ) == wxNOT_FOUND )
420  libs.RemoveAt( ii );
421  else
422  ii++;
423  }
424  }
425 
426  // Remove libs which have no power components, if this filter is activated
427  if( m_listPowerCmpOnly )
428  {
429  for( unsigned ii = 0; ii < libs.GetCount(); )
430  {
431  PART_LIB* lib = Prj().SchLibs()->FindLibrary( libs[ii] );
432 
433  if( lib && !lib->HasPowerParts() )
434  libs.RemoveAt( ii );
435  else
436  ii++;
437  }
438  }
439 
440  if( libs.IsEmpty() )
441  return;
442 
443  m_libList->Append( libs );
444 
445  // Search for a previous selection:
446  int index = m_libList->FindString( m_libraryName );
447 
448  if( index != wxNOT_FOUND )
449  {
450  m_libList->SetSelection( index, true );
451  }
452  else
453  {
454  // If not found, clear current library selection because it can be
455  // deleted after a config change.
456  m_libraryName = libs[0];
457  m_entryName = wxEmptyString;
458  m_unit = 1;
459  m_convert = 1;
460  }
461 
462  ReCreateListCmp();
464  DisplayLibInfos();
465  m_canvas->Refresh();
466 }
467 
468 
470 {
471  if( m_cmpList == NULL )
472  return;
473 
474  m_cmpList->Clear();
475 
476  PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
477 
478  if( !lib || lib->IsEmpty() )
479  {
480  m_libraryName = wxEmptyString;
481  m_entryName = wxEmptyString;
482  m_convert = 1;
483  m_unit = 1;
484  return;
485  }
486 
487  wxArrayString nameList;
488 
489  if( m_listPowerCmpOnly )
490  lib->GetEntryTypePowerNames( nameList );
491  else
492  lib->GetAliasNames( nameList );
493 
494  m_cmpList->Append( nameList );
495 
496  int index = m_cmpList->FindString( m_entryName );
497 
498  if( index == wxNOT_FOUND )
499  {
500  // Select the first library entry when the previous entry name does not exist in
501  // the current library.
502  m_convert = 1;
503  m_unit = 1;
504  index = 0;
505  }
506 
507  m_entryName = wxEmptyString;
508  m_cmpList->SetSelection( index, true );
509 
510  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
511  ProcessEvent( evt );
512 }
513 
514 
515 void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
516 {
517  int ii = m_libList->GetSelection();
518 
519  if( ii < 0 )
520  return;
521 
522  SetSelectedLibrary( m_libList->GetString( ii ) );
523 }
524 
525 
526 void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
527 {
528  if( m_libraryName == aLibraryName )
529  return;
530 
531  m_libraryName = aLibraryName;
532  ReCreateListCmp();
533  m_canvas->Refresh();
534  DisplayLibInfos();
536 
537  // Ensure the corresponding line in m_libList is selected
538  // (which is not necessary the case if SetSelectedLibrary is called
539  // by an other caller than ClickOnLibList.
540  m_libList->SetStringSelection( m_libraryName, true );
541 }
542 
543 
544 void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
545 {
546  int ii = m_cmpList->GetSelection();
547 
548  if( ii < 0 )
549  return;
550 
551  SetSelectedComponent( m_cmpList->GetString( ii ) );
552 }
553 
554 
555 void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
556 {
557  // Aren't component names case sensitive now?
558  if( m_entryName.CmpNoCase( aComponentName ) != 0 )
559  {
560  m_entryName = aComponentName;
561 
562  // Ensure the corresponding line in m_cmpList is selected
563  // (which is not necessarily the case if SetSelectedComponent is called
564  // by another caller than ClickOnCmpList.
565  m_cmpList->SetStringSelection( aComponentName, true );
566  DisplayLibInfos();
567  m_unit = 1;
568  m_convert = 1;
569  Zoom_Automatique( false );
571  m_canvas->Refresh();
572  }
573 }
574 
575 
576 void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
577 {
578  if( IsModal() )
579  {
581 
582  // The schematic editor might not be the parent of the library viewer.
583  // It could be a python window.
584  SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
585 
586  if( schframe )
587  {
588  // Prevent the double click from being as a single click in the parent
589  // window which would cause the part to be parked rather than staying
590  // in drag mode.
591  schframe->SkipNextLeftButtonReleaseEvent();
592  }
593  }
594 }
595 
596 
597 void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
598 {
599  int ii = m_cmpList->GetSelection();
600 
601  if( ii >= 0 )
602  {
603  wxString part_name = m_cmpList->GetString( ii );
604 
605  // a selection was made, pass true
606  DismissModal( true, part_name );
607  }
608  else
609  {
610  // no selection was made, pass false
611  DismissModal( false );
612  }
613 
614  Close( true );
615 }
616 
617 
618 #define LIBLIST_WIDTH_KEY "ViewLiblistWidth"
619 #define CMPLIST_WIDTH_KEY "ViewCmplistWidth"
620 #define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY "ViewCmpShowPinElectricalType"
621 
622 // Currently, the library viewer has no dialog to change the background color
623 // of the draw canvas. Therefore the background color is here just
624 // in case of this option is added to some library viewer config dialog
625 #define LIBVIEW_BGCOLOR "LibviewBgColor"
626 
627 
628 void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
629 {
631 
634 
635  aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
636  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
637  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
639 
640  // Set parameters to a reasonable value.
641  if( m_libListWidth > m_FrameSize.x/2 )
643 
644  if( m_cmpListWidth > m_FrameSize.x/2 )
646 }
647 
648 
649 void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
650 {
652 
653  if( m_libListWidth && m_libList )
654  {
655  m_libListWidth = m_libList->GetSize().x;
656  aCfg->Write( LIBLIST_WIDTH_KEY, m_libListWidth );
657  }
658 
659  m_cmpListWidth = m_cmpList->GetSize().x;
660  aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth );
661 
663 }
664 
665 
666 void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
667 {
669 
670  if( m_libList )
671  ReCreateListLib();
672 
673  DisplayLibInfos();
674 }
675 
676 
677 void LIB_VIEW_FRAME::CloseLibraryViewer( wxCommandEvent& event )
678 {
679  Close();
680 }
681 
682 
684 {
685  m_listPowerCmpOnly = false;
686  m_allowedLibs.Clear();
687 
688  if( aFilter )
689  {
690  m_allowedLibs = aFilter->GetAllowedLibList();
692  }
693 
694  ReCreateListLib();
695 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:474
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
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:139
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:444
#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:166
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:716
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:465
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:492
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:539
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:686
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:511
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:130
Definition for part library class.
void OnShowElectricalType(wxCommandEvent &event)
void DClickOnCmpList(wxCommandEvent &event)
Message panel definition file.
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.
void ReCreateListLib()
Function ReCreateListLib.
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...