KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 (C) 2023 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 { return nullptr; }
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
71protected:
72 FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
73
74private:
75 bool filterByPinCount();
76 bool filterByFPFilters();
77 bool filterFootprint( LIB_TREE_NODE& aNode );
78 void Show3DViewerFrame();
79
81 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
82
83 void OnPaint( wxPaintEvent& aEvent );
84 void OnOK( wxCommandEvent& aEvent );
85
86 void doCloseWindow() override;
87 void closeFootprintChooser( wxCommandEvent& aEvent );
88
90 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
91
92 void on3DviewReq( wxCommandEvent& event );
93 void onFpViewReq( wxCommandEvent& event );
94 void onExternalViewer3DEnable( wxCommandEvent& aEvent );
95
101
105 void updateViews();
106
107 // A command event sent by a PANEL_FOOTPRINT_CHOOSER will fire this event:
108 void onFpChanged( wxCommandEvent& event );
109
110 void build3DCanvas();
111
112 DECLARE_EVENT_TABLE()
113
114 friend struct PCB::IFACE; // constructor called from here only
115
116private:
118 bool m_showFpMode; // True to show the footprint
119 bool m_show3DMode; // True to show the 3D model
122 wxCheckBox* m_show3DViewer;
123
131
133 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_fpFilters;
134
135 // On MacOS (at least) SetFocus() calls made in the constructor will fail because a
136 // window that isn't yet visible will return false to AcceptsFocus(). So we must delay
137 // the initial-focus SetFocus() call to the first paint event.
139};
140
141#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:282
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:49
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 on3DviewReq(wxCommandEvent &event)
void onFpChanged(wxCommandEvent &event)
bool ShowModal(wxString *aFootprint, wxWindow *aParent) override
void OnPaint(wxPaintEvent &aEvent)
BOARD_ITEM_CONTAINER * GetModel() const override
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:279
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.
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
Declaration for a track ball camera.