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, 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
37class EDA_3D_CANVAS;
39class wxCheckBox;
40class BITMAP_BUTTON;
41class BOARD;
42class CAMERA;
43
44namespace PCB { struct IFACE; }
45
46
48{
49public:
51
53 BOARD_ITEM_CONTAINER* GetModel() const override;
54
59 bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
60
61 void KiwayMailIn( KIWAY_MAIL_EVENT& mail ) override;
62
68 void SetPosition( const wxPoint& aNewPosition );
69
70 bool Show( bool show ) override;
71
72 // We don't have a status bar
73 void SetStatusText( const wxString& aText, int aNumber = 0 ) override {}
74 void UpdateStatusBar() override {}
75
76protected:
77 FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
78
79private:
80 bool filterByPinCount();
81 bool filterByFPFilters();
82 bool filterFootprint( LIB_TREE_NODE& aNode );
83 void Show3DViewerFrame();
84
85 void setupUIConditions() override;
86
88 void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
89
90 void OnPaint( wxPaintEvent& aEvent );
91 void OnOK( wxCommandEvent& aEvent );
92
93 void doCloseWindow() override;
94 void closeFootprintChooser( wxCommandEvent& aEvent );
95
97 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
98
99 void toggleBottomSplit( wxCommandEvent& event );
100 void on3DviewReq( wxCommandEvent& event );
101 void onFpViewReq( wxCommandEvent& event );
102 void onExternalViewer3DEnable( wxCommandEvent& aEvent );
103
109
113 void updateViews();
114
115 // A command event sent by a PANEL_FOOTPRINT_CHOOSER will fire this event:
116 void onFpChanged( wxCommandEvent& event );
117
118 void build3DCanvas();
119
120 DECLARE_EVENT_TABLE()
121
122 friend struct PCB::IFACE; // constructor called from here only
123
124private:
127 inline static bool m_showDescription = true; // Init true to show the m_details panel
128 inline static bool m_showFpMode = true; // Init true to show the footprint
129 inline static bool m_show3DMode = false; // Init false to hide the 3D model
132 wxCheckBox* m_show3DViewer;
133
141
144
145 // On MacOS (at least) SetFocus() calls made in the constructor will fail because a
146 // window that isn't yet visible will return false to AcceptsFocus(). So we must delay
147 // the initial-focus SetFocus() call to the first paint event.
149};
150
151#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:322
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.
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:38
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:295
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.