KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 The 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
25#ifndef FOOTPRINT_VIEWER_FRAME_H
26#define FOOTPRINT_VIEWER_FRAME_H
27
28
29#include <wx/gdicmn.h>
30#include <pcb_base_frame.h>
31#include <pcbnew_settings.h>
33
34class wxSashLayoutWindow;
35class WX_LISTBOX;
36class wxSearchCtrl;
37class FP_LIB_TABLE;
38class BOARD_ITEM;
39class SELECTION;
40
41namespace PCB { struct IFACE; }
42
44{
45 NEW_PART = 0,
46 NEXT_PART = 1,
47 PREVIOUS_PART = 2,
48 RELOAD_PART = 3
49};
50
55{
56public:
58
60 BOARD_ITEM_CONTAINER* GetModel() const override;
61
63
64 virtual COLOR4D GetGridColor() override;
65
67 {
68 return &m_magneticItems;
69 }
70
77
82 void ReloadFootprint( FOOTPRINT* aFootprint ) override;
83
87 void AddFootprintToPCB();
88
98
100 void UpdateMsgPanel() override;
101
102 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
103
104 void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
105
106 void HardRedraw() override;
107
108protected:
109 FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent );
110
112
113 void setupUIConditions() override;
114
115 void doReCreateMenuBar() override;
116
117private:
118 const wxString getCurNickname();
119 void setCurNickname( const wxString& aNickname );
120
121 const wxString getCurFootprintName();
122 void setCurFootprintName( const wxString& aName );
123
124 void OnSize( wxSizeEvent& event ) override;
125
127
131 void UpdateTitle();
132
133 void displayFootprint( FOOTPRINT* aFootprint );
134
135 void doCloseWindow() override;
136 void CloseFootprintViewer( wxCommandEvent& event );
137 void OnExitKiCad( wxCommandEvent& event );
138
139 void OnLibFilter( wxCommandEvent& aEvent );
140 void OnFPFilter( wxCommandEvent& aEvent );
141 void OnCharHook( wxKeyEvent& aEvent ) override;
142
143 void selectPrev( WX_LISTBOX* aListBox );
144 void selectNext( WX_LISTBOX* aListBox );
145 void ClickOnLibList( wxCommandEvent& aEvent );
146 void ClickOnFootprintList( wxCommandEvent& aEvent );
147 void DClickOnFootprintList( wxMouseEvent& aEvent );
148
149 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
150 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
151
153
154 void CommonSettingsChanged( int aFlags ) override;
155
160 void OnActivate( wxActivateEvent& event );
161
163 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
164
165 void updateView();
166
167 DECLARE_EVENT_TABLE()
168
169 friend struct PCB::IFACE; // constructor called from here only
170
171private:
172 wxSearchCtrl* m_libFilter;
173 WX_LISTBOX* m_libList; // The list of library names.
174 int m_libListWidth; // Last width of the window.
175
176 wxSearchCtrl* m_fpFilter;
177 WX_LISTBOX* m_fpList; // The list of footprint names.
178 int m_fpListWidth; // Last width of the window.
179
181
184};
185
186#endif // FOOTPRINT_VIEWER_FRAME_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:78
Color settings are a bit different than most of the settings objects in that there can be more than o...
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
Component library viewer main window.
void displayFootprint(FOOTPRINT *aFootprint)
BOARD_ITEM_CONTAINER * GetModel() const override
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
void OnLibFilter(wxCommandEvent &aEvent)
void DClickOnFootprintList(wxMouseEvent &aEvent)
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void OnCharHook(wxKeyEvent &aEvent) override
Capture the key event before it is sent to the GUI.
void selectPrev(WX_LISTBOX *aListBox)
void ReCreateLibraryList()
Create or recreate the list of current loaded libraries.
void CloseFootprintViewer(wxCommandEvent &event)
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ReloadFootprint(FOOTPRINT *aFootprint) override
Override from PCB_BASE_FRAME which reloads the footprint from the library without setting the footpri...
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
virtual COLOR4D GetGridColor() override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void AddFootprintToPCB()
Export the current footprint name and close the library browser.
void OnActivate(wxActivateEvent &event)
Called when the frame frame is activate to reload the libraries and component lists that can be chang...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void setCurFootprintName(const wxString &aName)
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void OnExitKiCad(wxCommandEvent &event)
void setCurNickname(const wxString &aNickname)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnFPFilter(wxCommandEvent &aEvent)
void UpdateMsgPanel() override
Redraw the message panel.
MAGNETIC_SETTINGS m_magneticItems
void UpdateTitle()
Update the window title with current library information.
void SelectAndViewFootprint(FPVIEWER_CONSTANTS aMode)
Select and load the next or the previous footprint.
void selectNext(WX_LISTBOX *aListBox)
void ClickOnLibList(wxCommandEvent &aEvent)
void ClickOnFootprintList(wxCommandEvent &aEvent)
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
FPVIEWER_CONSTANTS
Store the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74