KiCad PCB EDA Suite
modview_frame.h
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) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #ifndef MODVIEWFRM_H_
30 #define MODVIEWFRM_H_
31 
32 
33 #include <wx/gdicmn.h>
34 
35 class wxSashLayoutWindow;
36 class wxListBox;
37 class FP_LIB_TABLE;
38 
39 namespace PCB { struct IFACE; }
40 
45 {
46  friend struct PCB::IFACE; // constructor called from here only
47 
48 protected:
49  FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType );
50 
51 
52 public:
54 
55  virtual COLOR4D GetGridColor() override;
56 
63  void ReCreateLibraryList();
64 
65 private:
66 
67  wxListBox* m_libList; // The list of libs names
68  wxListBox* m_footprintList; // The list of footprint names
69 
70  const wxString getCurNickname();
71  void setCurNickname( const wxString& aNickname );
72 
73  const wxString getCurFootprintName();
74  void setCurFootprintName( const wxString& aName );
75 
76  void OnSize( wxSizeEvent& event ) override;
77 
78  void ReCreateFootprintList();
79  void OnIterateFootprintList( wxCommandEvent& event );
80 
85  void UpdateTitle();
86 
92  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
93 
94  void OnCloseWindow( wxCloseEvent& Event ) override;
95  void CloseFootprintViewer( wxCommandEvent& event );
96 
97  void ReCreateHToolbar() override;
98  void ReCreateVToolbar() override;
99  void ReCreateMenuBar() override;
100 
101  void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
102  void ClickOnLibList( wxCommandEvent& event );
103  void ClickOnFootprintList( wxCommandEvent& event );
104  void DClickOnFootprintList( wxCommandEvent& event );
105  void OnSetRelativeOffset( wxCommandEvent& event );
106 
107  bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
108 
110  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
111 
120  bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
121 
122  void LoadSettings( wxConfigBase* aCfg ) override;
123  void SaveSettings( wxConfigBase* aCfg ) override;
124 
130  virtual void OnActivate( wxActivateEvent& event ) override;
131 
132  void SelectCurrentLibrary( wxCommandEvent& event );
133 
138  void SelectCurrentFootprint( wxCommandEvent& event );
139 
144  void ExportSelectedFootprint( wxCommandEvent& event );
145 
153  void SelectAndViewFootprint( int aMode );
154 
155  bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
156 
161  void Show3D_Frame( wxCommandEvent& event ) override;
162 
170  void Update3D_Frame( bool aForceReloadFootprint = true );
171 
172  /*
173  * Virtual functions, not used here, but needed by PCB_BASE_FRAME
174  * (virtual pure functions )
175  */
176  void OnLeftDClick( wxDC*, const wxPoint& ) override {}
177  void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
178  void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) override {}
179 
180  void updateView();
181 
182  DECLARE_EVENT_TABLE()
183 };
184 
185 #endif // MODVIEWFRM_H_
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: pcbnew.cpp:370
void ClickOnLibList(wxCommandEvent &event)
bool OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu) override
void UpdateTitle()
Function UpdateTitle updates the window title with current library information.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey handle hot key events.
void ClickOnFootprintList(wxCommandEvent &event)
void Update3D_Frame(bool aForceReloadFootprint=true)
Function Update3D_Frame must be called after a footprint selection Updates the 3D view and 3D frame t...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void DClickOnFootprintList(wxCommandEvent &event)
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 setCurFootprintName(const wxString &aName)
void OnCloseWindow(wxCloseEvent &Event) override
Component library viewer main window.
Definition: modview_frame.h:44
FOOTPRINT_VIEWER_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType)
void ReCreateVToolbar() override
void RedrawActiveWindow(wxDC *DC, bool EraseBg) override
Function RedrawActiveWindow Display the current selected component.
void Show3D_Frame(wxCommandEvent &event) override
Function Show3D_Frame (virtual) displays 3D view of the footprint (module) being edited.
void OnSize(wxSizeEvent &event) override
Function OnSize recalculates the size of toolbars and display panel when the frame size changes...
void setCurNickname(const wxString &aNickname)
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void SelectAndViewFootprint(int aMode)
Function SelectAndViewFootprint Select and load the next or the previous footprint if no current foot...
const wxString getCurFootprintName()
wxListBox * m_footprintList
Definition: modview_frame.h:68
void SaveCopyInUndoList(BOARD_ITEM *, UNDO_REDO_T, const wxPoint &) override
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Function GeneralControl performs application specific control using aDC at aPosition in logical units...
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
uint32_t EDA_KEY
Definition: common.h:52
void OnLeftDClick(wxDC *, const wxPoint &) override
void ExportSelectedFootprint(wxCommandEvent &event)
Function ExportSelectedFootprint exports the current footprint name and close the library browser...
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SelectCurrentFootprint(wxCommandEvent &event)
Function SelectCurrentFootprint Selects the current footprint name and display it.
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
void SelectCurrentLibrary(wxCommandEvent &event)
const wxString getCurNickname()
void OnSetRelativeOffset(wxCommandEvent &event)
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
void CloseFootprintViewer(wxCommandEvent &event)
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
void ReCreateLibraryList()
Function ReCreateLibraryList.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
void ReCreateHToolbar() override
virtual void OnActivate(wxActivateEvent &event) override
Function OnActivate is called when the frame frame is activate to reload the libraries and component ...
void OnIterateFootprintList(wxCommandEvent &event)
virtual COLOR4D GetGridColor() override
Function GetGridColor() , virtual.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
void SaveCopyInUndoList(const PICKED_ITEMS_LIST &, UNDO_REDO_T, const wxPoint &) override
Function SaveCopyInUndoList (virtual pure, overloaded).
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...