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 
33 #include <eda_3d_viewer.h>
34 #include <3d_canvas/cinfo3d_visu.h>
35 #include <menus_helpers.h>
36 #include <3d_viewer_id.h>
37 
38 
40 {
41  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ReCreateMainToolbar" );
42 
43  if( m_mainToolBar != NULL )
44  {
45  // Simple update to the list of old files.
46  SetToolbars();
47  return;
48  }
49 
50  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
51  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
52 
53  // Set up toolbar
54  m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
55  KiBitmap( import3d_xpm ), _( "Reload board" ) );
56 
57  m_mainToolBar->AddSeparator();
58 
59  m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
60  KiBitmap( copy_xpm ),
61  _( "Copy 3D image to clipboard" ) );
62 
63  m_mainToolBar->AddSeparator();
64 
65  m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
66  KiBitmap( read_setup_xpm ),
67  _( "Set display options, and some layers visibility" ) );
68  m_mainToolBar->AddSeparator();
69 
70  m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString, KiBitmap( render_mode_xpm ),
71  _( "Render current view using Raytracing" ), wxITEM_CHECK );
72 
73  m_mainToolBar->AddSeparator();
74 
75  m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
76  _( "Zoom in" ) );
77 
78  m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
79  _( "Zoom out" ) );
80 
81  m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
82  KiBitmap( zoom_redraw_xpm ),
83  _( "Redraw view" ) );
84 
85  m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
86  _( "Zoom to fit 3D model" ) );
87 
88  m_mainToolBar->AddSeparator();
89  m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
90  KiBitmap( rotate_neg_x_xpm ),
91  _( "Rotate X Clockwise" ) );
92 
93  m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
94  KiBitmap( rotate_pos_x_xpm ),
95  _( "Rotate X Counterclockwise" ) );
96 
97  m_mainToolBar->AddSeparator();
98  m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
99  KiBitmap( rotate_neg_y_xpm ),
100  _( "Rotate Y Clockwise" ) );
101 
102  m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
103  KiBitmap( rotate_pos_y_xpm ),
104  _( "Rotate Y Counterclockwise" ) );
105 
106  m_mainToolBar->AddSeparator();
107  m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
108  KiBitmap( rotate_neg_z_xpm ),
109  _( "Rotate Z Clockwise" ) );
110 
111  m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
112  KiBitmap( rotate_pos_z_xpm ),
113  _( "Rotate Z Counterclockwise" ) );
114 
115  m_mainToolBar->AddSeparator();
116  m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
117  _( "Move left" ) );
118 
119  m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
120  _( "Move right" ) );
121 
122  m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
123  _( "Move up" ) );
124 
125  m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
126  _( "Move down" ) );
127 
128  m_mainToolBar->AddSeparator();
129  m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
130  _( "Enable/Disable orthographic projection" ),
131  wxITEM_CHECK );
132 
133  m_mainToolBar->Realize();
134 }
135 
136 
138 {
139 }
Definition: id.h:241
Handles data related with the board to be visualized.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void ReCreateMainToolbar()
Definition: 3d_toolbar.cpp:39
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
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.
void SetToolbars()
Definition: 3d_toolbar.cpp:137
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars