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 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef FOOTPRINT_VIEWER_FRAME_H
22#define FOOTPRINT_VIEWER_FRAME_H
23
24
25#include <wx/gdicmn.h>
26#include <pcb_base_frame.h>
27#include <pcbnew_settings.h>
29
30class wxSashLayoutWindow;
31class WX_LISTBOX;
32class wxSearchCtrl;
33class FP_LIB_TABLE;
34class BOARD_ITEM;
35class SELECTION;
36
37namespace PCB { struct IFACE; }
38
46
51{
52public:
54
56 BOARD_ITEM_CONTAINER* GetModel() const override;
57
59
60 virtual COLOR4D GetGridColor() override;
61
66
73
78 void ReloadFootprint( FOOTPRINT* aFootprint ) override;
79
83 void AddFootprintToPCB();
84
94
96 void UpdateMsgPanel() override;
97
98 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
99
100 void KiwayMailIn( KIWAY_MAIL_EVENT& mail ) override;
101
102 void HardRedraw() override;
103
104protected:
105 FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent );
106
108
109 void setupUIConditions() override;
110
111 void doReCreateMenuBar() override;
112
113private:
114 const wxString getCurNickname();
115 void setCurNickname( const wxString& aNickname );
116
117 const wxString getCurFootprintName();
118 void setCurFootprintName( const wxString& aName );
119
120 void OnSize( wxSizeEvent& event ) override;
121
123
127 void UpdateTitle();
128
129 void displayFootprint( FOOTPRINT* aFootprint );
130
131 void doCloseWindow() override;
132 void CloseFootprintViewer( wxCommandEvent& event );
133 void OnExitKiCad( wxCommandEvent& event );
134
135 void OnLibFilter( wxCommandEvent& aEvent );
136 void OnFPFilter( wxCommandEvent& aEvent );
137 void OnCharHook( wxKeyEvent& aEvent ) override;
138
139 void selectPrev( WX_LISTBOX* aListBox );
140 void selectNext( WX_LISTBOX* aListBox );
141 void ClickOnLibList( wxCommandEvent& aEvent );
142 void ClickOnFootprintList( wxCommandEvent& aEvent );
143 void DClickOnFootprintList( wxMouseEvent& aEvent );
144
145 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
146 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
147
149
150 void CommonSettingsChanged( int aFlags ) override;
151
156 void OnActivate( wxActivateEvent& event );
157
159 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
160
161 void updateView();
162
163 DECLARE_EVENT_TABLE()
164
165 friend struct PCB::IFACE; // constructor called from here only
166
167private:
168 wxSearchCtrl* m_libFilter;
169 WX_LISTBOX* m_libList; // The list of library names.
170 int m_libListWidth; // Last width of the window.
171
172 wxSearchCtrl* m_fpFilter;
173 WX_LISTBOX* m_fpList; // The list of footprint names.
174 int m_fpListWidth; // Last width of the window.
175
177
180};
181
182#endif // FOOTPRINT_VIEWER_FRAME_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
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:81
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 component information found in a netlist.
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)
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 KiwayMailIn(KIWAY_MAIL_EVENT &mail) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
FOOTPRINT_VIEWER_FRAME(KIWAY *aKiway, wxWindow *aParent)
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.
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:101
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:34
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Store the common settings that are saved and loaded for each window / frame.