KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
footprint_chooser_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) 2023 CERN
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_CHOOSER_FRAME_H
26#define FOOTPRINT_CHOOSER_FRAME_H
27
28
29#include <wx/gdicmn.h>
30#include <pcb_base_frame.h>
31#include <pcbnew_settings.h>
33#include <lib_tree_model.h>
36
38class wxCheckBox;
39class BITMAP_BUTTON;
40class BOARD;
41class CAMERA;
42
43namespace PCB { struct IFACE; }
44
45
47{
48public:
50
52 BOARD_ITEM_CONTAINER* GetModel() const override;
53
58 bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
59
60 void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
61
67 void SetPosition( const wxPoint& aNewPosition );
68
69 bool Show( bool show ) override;
70
71 // We don't have a status bar
72 void SetStatusText( const wxString& aText, int aNumber = 0 ) override {}
73 void UpdateStatusBar() override {}
74
75protected:
76 FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
77
78private:
79 bool filterByPinCount();
80 bool filterByFPFilters();
81 bool filterFootprint( LIB_TREE_NODE& aNode );
82 void Show3DViewerFrame();
83
84 void setupUIConditions() override;
85
87 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
88
89 void OnPaint( wxPaintEvent& aEvent );
90 void OnOK( wxCommandEvent& aEvent );
91
92 void doCloseWindow() override;
93 void closeFootprintChooser( wxCommandEvent& aEvent );
94
96 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
97
98 void on3DviewReq( wxCommandEvent& event );
99 void onFpViewReq( wxCommandEvent& event );
100 void onExternalViewer3DEnable( wxCommandEvent& aEvent );
101
107
111 void updateViews();
112
113 // A command event sent by a PANEL_FOOTPRINT_CHOOSER will fire this event:
114 void onFpChanged( wxCommandEvent& event );
115
116 void build3DCanvas();
117
118 DECLARE_EVENT_TABLE()
119
120 friend struct PCB::IFACE; // constructor called from here only
121
122private:
124 bool m_showFpMode; // True to show the footprint
125 bool m_show3DMode; // True to show the 3D model
128 wxCheckBox* m_show3DViewer;
129
137
139 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_fpFilters;
140
141 // On MacOS (at least) SetFocus() calls made in the constructor will fail because a
142 // window that isn't yet visible will return false to AcceptsFocus(). So we must delay
143 // the initial-focus SetFocus() call to the first paint event.
145};
146
147#endif // FOOTPRINT_CHOOSER_FRAME_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:73
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
A class used to derive camera objects from.
Definition: camera.h:103
Color settings are a bit different than most of the settings objects in that there can be more than o...
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:51
Interface for a pattern matcher for which there are several implementations.
void onFpViewReq(wxCommandEvent &event)
void updateViews()
Must be called after loading a new footprint: update footprint and/or 3D views.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void closeFootprintChooser(wxCommandEvent &aEvent)
bool filterFootprint(LIB_TREE_NODE &aNode)
void UpdateStatusBar() override
Update the status bar information.
void SetStatusText(const wxString &aText, int aNumber=0) override
void on3DviewReq(wxCommandEvent &event)
void onFpChanged(wxCommandEvent &event)
bool ShowModal(wxString *aFootprint, wxWindow *aParent) override
void OnPaint(wxPaintEvent &aEvent)
BOARD_ITEM_CONTAINER * GetModel() const override
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
bool Show(bool show) override
void OnOK(wxCommandEvent &aEvent)
void updatePanelsVisibility()
Show hide footprint view panel and/or 3d view panel according to the options (display 3D shapes and u...
void SetPosition(const wxPoint &aNewPosition)
Force the position of the dialog to a new position.
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_fpFilters
void onExternalViewer3DEnable(wxCommandEvent &aEvent)
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh) const override
Helper to retrieve the current color settings.
PANEL_FOOTPRINT_CHOOSER * m_chooserPanel
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
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
STL namespace.
Store the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
Declaration for a track ball camera.