KiCad PCB EDA Suite
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) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
32 #ifndef EDA_3D_VIEWER_H
33 #define EDA_3D_VIEWER_H
34 
38 #include <kiway_player.h>
39 #include <wx/colourdata.h>
40 #include <dialogs/dialog_color_picker.h> // for CUSTOM_COLORS_LIST definition
41 
42 
45 #define KICAD6_3DMODEL_DIR wxT( "KICAD6_3DMODEL_DIR" )
46 
47 
48 #define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
49 
50 
52 {
53  ACTIVITY = 0,
57 };
58 
63 {
64 public:
65  EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, const wxString& aTitle,
66  long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
67 
69 
70  PCB_BASE_FRAME* Parent() const { return (PCB_BASE_FRAME*)GetParent(); }
71 
72  BOARD* GetBoard() { return Parent()->GetBoard(); }
73 
74  wxWindow* GetToolCanvas() const override { return m_canvas; }
75 
76  void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
77 
86  void ReloadRequest();
87 
88  // !TODO: review this function: it need a way to tell what changed,
89  // to only reload/rebuild things that have really changed
100  void NewDisplay( bool aForceImmediateRedraw = false );
101 
102  void Redraw();
103 
104  BOARD_ADAPTER& GetAdapter() override { return m_boardAdapter; }
105  CAMERA& GetCurrentCamera() override { return m_currentCamera; }
106 
108 
109  void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
110  void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
111 
118  void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
119 
120 protected:
121  void setupUIConditions() override;
122 
123 private:
125  void Exit3DFrame( wxCommandEvent& event );
126 
127  void OnCloseWindow( wxCloseEvent& event );
128 
129  void Process_Special_Functions( wxCommandEvent& event );
130 
131  void OnRenderEngineSelection( wxCommandEvent& event );
132  void OnDisableRayTracing( wxCommandEvent& aEvent );
133 
134  void OnActivate( wxActivateEvent& event );
135 
136  void OnSetFocus( wxFocusEvent& event );
137 
138  void Install3DViewOptionDialog( wxCommandEvent& event );
139 
140  void CreateMenuBar();
141  void ReCreateMainToolbar();
142 
147  void takeScreenshot( wxCommandEvent& event );
148 
152  void RenderEngineChanged();
153 
154  void refreshRender();
155 
156  DECLARE_EVENT_TABLE()
157 
158 
161  void loadCommonSettings();
162 
164 
170 
172 
179  static const wxChar *m_logTrace;
180 
181 };
182 
183 #endif // EDA_3D_VIEWER_H
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
Define the structure of a toolbar with buttons that invoke ACTIONs.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:64
CAMERA & GetCurrentCamera() override
BOARD_ADAPTER m_boardAdapter
PCB_BASE_FRAME * Parent() const
void OnSetFocus(wxFocusEvent &event)
void ReCreateMainToolbar()
Definition: 3d_toolbar.cpp:36
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void Process_Special_Functions(wxCommandEvent &event)
ACTION_TOOLBAR * m_mainToolBar
EDA_3D_CANVAS * GetCanvas()
EDA_3D_CANVAS * m_canvas
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification that common settings are updated.
void OnDisableRayTracing(wxCommandEvent &aEvent)
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
wxFileName m_defaultSaveScreenshotFileName
void loadCommonSettings()
Load configuration from common settings.
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allow a frame to load its preference panels (if any) into the preferences dialog.
A class used to derive camera objects from.
Definition: camera.h:77
void OnCloseWindow(wxCloseEvent &event)
BOARD_ADAPTER & GetAdapter() override
void Install3DViewOptionDialog(wxCommandEvent &event)
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
EDA_3D_VIEWER_FRAME(KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxString &aTitle, long style=KICAD_DEFAULT_3D_DRAWFRAME_STYLE)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void takeScreenshot(wxCommandEvent &event)
Create a Screenshot of the current 3D view.
void ReloadRequest()
Request reloading the 3D view.
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE
EDA_3D_VIEWER_STATUSBAR
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
wxWindow * GetToolCanvas() const override
Canvas access.
BOARD * GetBoard() const
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:68
Declaration for a track ball camera.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void OnRenderEngineSelection(wxCommandEvent &event)
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
void OnActivate(wxActivateEvent &event)
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.