KiCad PCB EDA Suite
3d_toolbar.cpp
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) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
6  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
7  * Copyright (C) 1992-2019 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 
31 #include <fctsys.h>
32 #include <wx/wupdlock.h>
33 #include <eda_3d_viewer.h>
34 #include <menus_helpers.h>
35 #include <tool/action_toolbar.h>
36 #include <tools/3d_actions.h>
37 #include <3d_viewer_id.h>
38 
40 {
41  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ReCreateMainToolbar" );
42 
43  wxWindowUpdateLocker dummy( this );
44 
45  if( m_mainToolBar )
47  else
48  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
49  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
50 
51  // Set up toolbar
52  m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
53  KiScaledBitmap( import3d_xpm, this ), _( "Reload board" ) );
54 
56  m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
57  KiScaledBitmap( copy_xpm, this ),
58  _( "Copy 3D image to clipboard" ) );
59 
61  m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
63  _( "Set display options, and some layers visibility" ) );
64 
66  m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
68  _( "Render current view using Raytracing" ), wxITEM_CHECK );
69 
75 
79 
83 
87 
90 
96 
99 
100  m_mainToolBar->Realize();
101 }
102 
103 
105 {
107 
109  m_mainToolBar->Refresh();
110 }
static TOOL_ACTION rotateXCW
Definition: 3d_actions.h:47
ACTION_TOOLBAR.
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
static const bool TOGGLE
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
Definition: 3d_toolbar.cpp:104
const BITMAP_OPAQUE import3d_xpm[1]
Definition: import3d.cpp:61
CCAMERA & m_currentCamera
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, wxWindow *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
static TOOL_ACTION flipView
Definition: 3d_actions.h:59
const BITMAP_OPAQUE read_setup_xpm[1]
Definition: read_setup.cpp:99
static TOOL_ACTION moveLeft
Definition: 3d_actions.h:53
PROJECTION_TYPE GetProjection()
Definition: ccamera.h:164
static TOOL_ACTION rotateYCW
Definition: 3d_actions.h:49
static TOOL_ACTION rotateXCCW
Definition: 3d_actions.h:48
const BITMAP_OPAQUE copy_xpm[1]
Definition: copy.cpp:67
void ReCreateMainToolbar()
Definition: 3d_toolbar.cpp:39
static TOOL_ACTION rotateZCCW
Definition: 3d_actions.h:52
static TOOL_ACTION rotateZCW
Definition: 3d_actions.h:51
static TOOL_ACTION moveDown
Definition: 3d_actions.h:56
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Declaration of the eda_3d_viewer class.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
static TOOL_ACTION rotateYCCW
Definition: 3d_actions.h:50
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.
static TOOL_ACTION moveUp
Definition: 3d_actions.h:55
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
ACTION_TOOLBAR * m_mainToolBar
const BITMAP_OPAQUE render_mode_xpm[1]
Definition: render_mode.cpp:92
static TOOL_ACTION toggleOrtho
Definition: 3d_actions.h:60
static TOOL_ACTION moveRight
Definition: 3d_actions.h:54
void ClearToolbar()
Clear the toolbar and remove all associated menus.