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 filterFootprint( LIB_TREE_NODE& aNode );
76
77 void OnPaint( wxPaintEvent& aEvent );
78 void OnOK( wxCommandEvent& aEvent );
79
80 void doCloseWindow() override;
81 void closeFootprintChooser( wxCommandEvent& aEvent );
82
84 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
85 void on3DviewReq( wxCommandEvent& event );
86 void onFpViewReq( wxCommandEvent& event );
87
88 // A command event sent by a PANEL_FOOTPRINT_CHOOSER will fire this event:
89 void onFpChanged( wxCommandEvent& event );
90
91 void build3DCanvas();
92
93 DECLARE_EVENT_TABLE()
94
95 friend struct PCB::IFACE; // constructor called from here only
96
97private:
99 bool m_showFpMode; // True to show the footprint, false for 3D model
102
110
112 std::vector<std::unique_ptr<EDA_PATTERN_MATCH>> m_fpFilters;
113
114 // On MacOS (at least) SetFocus() calls made in the constructor will fail because a
115 // window that isn't yet visible will return false to AcceptsFocus(). So we must delay
116 // the initial-focus SetFocus() call to the first paint event.
118};
119
120#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:41
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:276
A class used to derive camera objects from.
Definition: camera.h:102
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)
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 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.
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_fpFilters
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:39
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.