KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_3d_viewer_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) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 2023 CERN
8 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23 * or you may search the http://www.gnu.org website for the version 2 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
33#ifndef EDA_3D_VIEWER_H
34#define EDA_3D_VIEWER_H
35
39#include <kiway_player.h>
40#include <wx/colourdata.h>
41#include <dialogs/dialog_color_picker.h> // for CUSTOM_COLORS_LIST definition
42
43
46#define KICAD7_3DMODEL_DIR wxT( "KICAD7_3DMODEL_DIR" )
47
48
49#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
50
51// Forward declarations
54
55
57{
63};
64
69{
70public:
71 EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, const wxString& aTitle,
73
75
76 PCB_BASE_FRAME* Parent() const { return (PCB_BASE_FRAME*)GetParent(); }
77
78 BOARD* GetBoard() { return Parent()->GetBoard(); }
79
80 wxWindow* GetToolCanvas() const override { return m_canvas; }
81
90 void ReloadRequest();
91
92 // !TODO: review this function: it need a way to tell what changed,
93 // to only reload/rebuild things that have really changed
104 void NewDisplay( bool aForceImmediateRedraw = false );
105
106 void Redraw();
107
110
112
113 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
114 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
115
122 void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
123 void ShowChangedLanguage() override;
124
126
128
129 void OnDarkModeToggle();
130
131protected:
132 void setupUIConditions() override;
133
134 void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
135
136private:
138 void Exit3DFrame( wxCommandEvent& event );
139
140 void OnCloseWindow( wxCloseEvent& event );
141
142 bool TryBefore( wxEvent& aEvent ) override;
143
144 void Process_Special_Functions( wxCommandEvent& event );
145
146 void onRenderEngineSelection( wxCommandEvent& event );
147 void onDisableRayTracing( wxCommandEvent& aEvent );
148
149 void OnActivate( wxActivateEvent& event );
150 void OnSetFocus( wxFocusEvent& event );
151
152 void doReCreateMenuBar() override;
153 void ReCreateMainToolbar();
154
159 void takeScreenshot( wxCommandEvent& event );
160
164 void RenderEngineChanged();
165
166 void refreshRender();
167
168 DECLARE_EVENT_TABLE()
169
170
173 void loadCommonSettings();
174
175private:
177
183
185
187
194 static const wxChar *m_logTrace;
195
196};
197
198#endif // EDA_3D_VIEWER_H
Define the structure of a toolbar with buttons that invoke ACTIONs.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:70
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:271
A class used to derive camera objects from.
Definition: camera.h:79
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
wxWindow * GetToolCanvas() const override
Canvas access.
void OnSetFocus(wxFocusEvent &event)
void onDisableRayTracing(wxCommandEvent &aEvent)
void takeScreenshot(wxCommandEvent &event)
Create a Screenshot of the current 3D view.
ACTION_TOOLBAR * m_mainToolBar
BOARD_ADAPTER & GetAdapter() override
PCB_BASE_FRAME * Parent() const
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void OnActivate(wxActivateEvent &event)
bool TryBefore(wxEvent &aEvent) override
EDA_3D_CANVAS * m_canvas
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.
BOARD_ADAPTER m_boardAdapter
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
void Process_Special_Functions(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &event)
void doReCreateMenuBar() override
Definition: 3d_menubar.cpp:39
void ReCreateMainToolbar()
Definition: 3d_toolbar.cpp:39
void ShowChangedLanguage() override
EDA_3D_VIEWER_FRAME(KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxString &aTitle, long style=KICAD_DEFAULT_3D_DRAWFRAME_STYLE)
CAMERA & GetCurrentCamera() override
void ReloadRequest()
Request reloading the 3D view.
wxFileName m_defaultSaveScreenshotFileName
EDA_3D_CANVAS * GetCanvas()
void onRenderEngineSelection(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
NL_3D_VIEWER_PLUGIN * m_spaceMouse
void loadCommonSettings()
Load configuration from common settings.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification that common settings are updated.
APPEARANCE_CONTROLS_3D * GetAppearanceManager()
void handleIconizeEvent(wxIconizeEvent &aEvent) override
Handle a window iconize event.
APPEARANCE_CONTROLS_3D * m_appearancePanel
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
The class that implements the public interface to the SpaceMouse plug-in.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard() const
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE
EDA_3D_VIEWER_STATUSBAR
@ ZOOM_LEVEL
@ ACTIVITY
@ HOVERED_ITEM
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Declaration for a track ball camera.