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
88 void HardRedraw() override;
89
90protected:
91 FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent );
92
94
95 void setupUIConditions() override;
96
97 void doReCreateMenuBar() override;
98
99private:
100 const wxString getCurNickname();
101 void setCurNickname( const wxString& aNickname );
102
103 const wxString getCurFootprintName();
104 void setCurFootprintName( const wxString& aName );
105
106 void OnSize( wxSizeEvent& event ) override;
107
109 void OnIterateFootprintList( wxCommandEvent& event );
110
114 void UpdateTitle();
115
116 void displayFootprint( FOOTPRINT* aFootprint );
117
118 void doCloseWindow() override;
119 void CloseFootprintViewer( wxCommandEvent& event );
120 void OnExitKiCad( wxCommandEvent& event );
121
122 void ReCreateHToolbar() override;
123 void ReCreateVToolbar() override;
124 void ReCreateOptToolbar() override;
125
126 void OnLibFilter( wxCommandEvent& aEvent );
127 void OnFPFilter( wxCommandEvent& aEvent );
128 void OnCharHook( wxKeyEvent& aEvent ) override;
129
130 void selectPrev( WX_LISTBOX* aListBox );
131 void selectNext( WX_LISTBOX* aListBox );
132 void ClickOnLibList( wxCommandEvent& aEvent );
133 void ClickOnFootprintList( wxCommandEvent& aEvent );
134 void DClickOnFootprintList( wxMouseEvent& aEvent );
135
136 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
137 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
138
140
141 void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
142
147 void OnActivate( wxActivateEvent& event );
148
152 void AddFootprintToPCB( wxCommandEvent& aEvent );
153
162 void SelectAndViewFootprint( int aMode );
163
165 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
166
167 void updateView();
168
169 DECLARE_EVENT_TABLE()
170
171 friend struct PCB::IFACE; // constructor called from here only
172
173private:
174 wxSearchCtrl* m_libFilter;
175 WX_LISTBOX* m_libList; // The list of library names.
176 int m_libListWidth; // Last width of the window.
177
178 wxSearchCtrl* m_fpFilter;
179 WX_LISTBOX* m_fpList; // The list of footprint names.
180 int m_fpListWidth; // Last width of the window.
181
183
186};
187
188#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:79
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 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.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
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:284
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