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 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_CHOOSER_FRAME_H
22#define FOOTPRINT_CHOOSER_FRAME_H
23
24
25#include <wx/gdicmn.h>
26#include <pcb_base_frame.h>
27#include <pcbnew_settings.h>
29#include <lib_tree_model.h>
32
33class EDA_3D_CANVAS;
35class wxCheckBox;
36class BITMAP_BUTTON;
37class BOARD;
38class CAMERA;
39
40namespace PCB { struct IFACE; }
41
42
44{
45public:
47
49 BOARD_ITEM_CONTAINER* GetModel() const override;
50
55 bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
56
57 void KiwayMailIn( KIWAY_MAIL_EVENT& mail ) override;
58
64 void SetPosition( const wxPoint& aNewPosition );
65
66 bool Show( bool show ) override;
67
68 // We don't have a status bar
69 void SetStatusText( const wxString& aText, int aNumber = 0 ) override {}
70 void UpdateStatusBar() override {}
71
72protected:
73 FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
74
75private:
76 bool filterByPinCount();
77 bool filterByFPFilters();
78 bool filterFootprint( LIB_TREE_NODE& aNode );
79 void Show3DViewerFrame();
80
81 void setupUIConditions() override;
82
84 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
85
86 void OnPaint( wxPaintEvent& aEvent );
87 void OnOK( wxCommandEvent& aEvent );
88
89 void doCloseWindow() override;
90 void closeFootprintChooser( wxCommandEvent& aEvent );
91
93 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
94
95 void toggleBottomSplit( wxCommandEvent& event );
96 void on3DviewReq( wxCommandEvent& event );
97 void onFpViewReq( wxCommandEvent& event );
98 void onExternalViewer3DEnable( wxCommandEvent& aEvent );
99
105
109 void updateViews();
110
111 // A command event sent by a PANEL_FOOTPRINT_CHOOSER will fire this event:
112 void onFpChanged( wxCommandEvent& event );
113
114 void build3DCanvas();
115
116 DECLARE_EVENT_TABLE()
117
118 friend struct PCB::IFACE; // constructor called from here only
119
120private:
123 inline static bool m_showDescription = true; // Init true to show the m_details panel
124 inline static bool m_showFpMode = true; // Init true to show the footprint
125 inline static bool m_show3DMode = false; // Init false to hide the 3D model
128 wxCheckBox* m_show3DViewer;
129
137
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.
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Helper class to handle information needed to display 3D board.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:320
A class used to derive camera objects from.
Definition camera.h:99
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.
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 KiwayMailIn(KIWAY_MAIL_EVENT &mail) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
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)
FOOTPRINT_CHOOSER_FRAME(KIWAY *aKiway, wxWindow *aParent)
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 toggleBottomSplit(wxCommandEvent &event)
void SetPosition(const wxPoint &aNewPosition)
Force the position of the dialog to a new position.
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_mail.h:34
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
STL class.
STL namespace.
Store the common settings that are saved and loaded for each window / frame.
Declaration for a track ball camera.