KiCad PCB EDA Suite
footprint_viewer_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) 2018 Jean-Pierre Charras, jap.charras at wanadoo.fr
5  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.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 FOOTPRINT_VIEWER_FRAME_H
30 #define FOOTPRINT_VIEWER_FRAME_H
31 
32 
33 #include <wx/gdicmn.h>
34 #include <pcb_base_frame.h>
35 
36 class wxSashLayoutWindow;
37 class wxListBox;
38 class FP_LIB_TABLE;
39 class BOARD_ITEM;
40 
41 namespace PCB { struct IFACE; }
42 
47 {
48  friend struct PCB::IFACE; // constructor called from here only
49 
50 protected:
51  FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType );
52 
53 
54 public:
56 
57  PCB_GENERAL_SETTINGS& GetConfigSettings() { return m_configSettings; }
58 
60  void ApplyDisplaySettingsToGAL();
61 
62  virtual COLOR4D GetGridColor() override;
63 
64  bool GetAutoZoom() const { return m_autoZoom; }
65  void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; }
66 
72  void UpdateMsgPanel() override;
73 
80  void ReCreateLibraryList();
81 
89  bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
90 
91 private:
92 
93  wxListBox* m_libList; // The list of libs names
94  wxListBox* m_footprintList; // The list of footprint names
95 
96  bool m_autoZoom;
97  double m_lastZoom;
98 
99  const wxString getCurNickname();
100  void setCurNickname( const wxString& aNickname );
101 
102  const wxString getCurFootprintName();
103  void setCurFootprintName( const wxString& aName );
104 
105  void OnSize( wxSizeEvent& event ) override;
106 
107  void ReCreateFootprintList();
108  void OnIterateFootprintList( wxCommandEvent& event );
109 
114  void UpdateTitle();
115 
121  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
122 
123  void OnCloseWindow( wxCloseEvent& Event ) override;
124  void CloseFootprintViewer( wxCommandEvent& event );
125 
126  void ReCreateHToolbar() override;
127  void ReCreateVToolbar() override;
128  void ReCreateMenuBar() override;
129 
130  void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
131  void ClickOnLibList( wxCommandEvent& event );
132  void ClickOnFootprintList( wxCommandEvent& event );
133  void DClickOnFootprintList( wxCommandEvent& event );
134  void OnSetRelativeOffset( wxCommandEvent& event );
135 
136  void InstallDisplayOptions( wxCommandEvent& event );
137 
138  bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
139 
141  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
142 
151  bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
152 
153  void LoadSettings( wxConfigBase* aCfg ) override;
154  void SaveSettings( wxConfigBase* aCfg ) override;
155 
161  virtual void OnActivate( wxActivateEvent& event ) override;
162 
167  void SelectCurrentFootprint( wxCommandEvent& event );
168 
173  void ExportSelectedFootprint( wxCommandEvent& event );
174 
182  void SelectAndViewFootprint( int aMode );
183 
184  bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
185 
190  void Show3D_Frame( wxCommandEvent& event ) override;
191 
199  void Update3D_Frame( bool aForceReloadFootprint = true );
200 
201  /*
202  * Virtual functions, not used here, but needed by PCB_BASE_FRAME
203  * (virtual pure functions )
204  */
205  void OnLeftDClick( wxDC*, const wxPoint& ) override {}
206  void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
207  void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) override {}
208 
209  void updateView();
210 
211  DECLARE_EVENT_TABLE()
212 };
213 
214 #endif // FOOTPRINT_VIEWER_FRAME_H
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: pcbnew.cpp:398
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
Component library viewer main window.
void SetAutoZoom(bool aEnable)
Classes used in Pcbnew, CvPcb and GerbView.
void SaveCopyInUndoList(BOARD_ITEM *, UNDO_REDO_T, const wxPoint &) override
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
uint32_t EDA_KEY
Definition: common.h:73
void OnLeftDClick(wxDC *, const wxPoint &) override
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
PCB_GENERAL_SETTINGS & GetConfigSettings()
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
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).
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39