KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2022 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
47{
48public:
50
52 BOARD_ITEM_CONTAINER* GetModel() const override;
53
55
56 virtual COLOR4D GetGridColor() override;
57
59 {
60 return &m_magneticItems;
61 }
62
69
73 void OnUpdateFootprintButton( wxUpdateUIEvent& aEvent );
74
79 void ReloadFootprint( FOOTPRINT* aFootprint ) override;
80
82 void UpdateMsgPanel() override;
83
84 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
85
86 void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
87
88protected:
89 FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent );
90
92
93 void setupUIConditions() override;
94
95 void doReCreateMenuBar() override;
96
97private:
98 const wxString getCurNickname();
99 void setCurNickname( const wxString& aNickname );
100
101 const wxString getCurFootprintName();
102 void setCurFootprintName( const wxString& aName );
103
104 void OnSize( wxSizeEvent& event ) override;
105
107 void OnIterateFootprintList( wxCommandEvent& event );
108
112 void UpdateTitle();
113
114 void displayFootprint( FOOTPRINT* aFootprint );
115
116 void doCloseWindow() override;
117 void CloseFootprintViewer( wxCommandEvent& event );
118 void OnExitKiCad( wxCommandEvent& event );
119
120 void ReCreateHToolbar() override;
121 void ReCreateVToolbar() override;
122 void ReCreateOptToolbar() override;
123
124 void OnLibFilter( wxCommandEvent& aEvent );
125 void OnFPFilter( wxCommandEvent& aEvent );
126 void OnCharHook( wxKeyEvent& aEvent ) override;
127
128 void selectPrev( WX_LISTBOX* aListBox );
129 void selectNext( WX_LISTBOX* aListBox );
130 void ClickOnLibList( wxCommandEvent& aEvent );
131 void ClickOnFootprintList( wxCommandEvent& aEvent );
132 void DClickOnFootprintList( wxMouseEvent& aEvent );
133
134 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
135 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
136
138
139 void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
140
145 void OnActivate( wxActivateEvent& event );
146
150 void AddFootprintToPCB( wxCommandEvent& aEvent );
151
160 void SelectAndViewFootprint( int aMode );
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:77
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:86
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 OnIterateFootprintList(wxCommandEvent &event)
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
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.
virtual COLOR4D GetGridColor() override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
void SelectAndViewFootprint(int aMode)
Select and load the next or the previous footprint.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void OnUpdateFootprintButton(wxUpdateUIEvent &aEvent)
Update the ID_ADD_FOOTPRINT_TO_BOARD tool state in main toolbar.
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 AddFootprintToPCB(wxCommandEvent &aEvent)
Export the current footprint name and close the library browser.
void UpdateMsgPanel() override
Redraw the message panel.
MAGNETIC_SETTINGS m_magneticItems
void UpdateTitle()
Update the window title with current library information.
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:279
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74