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-2018 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, wxT( "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,
71  KiBitmap( render_mode_xpm ),
72  _( "Render current view using Raytracing" ) );
73 
74  m_mainToolBar->AddSeparator();
75 
76  m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
77  _( "Zoom in" ) );
78 
79  m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
80  _( "Zoom out" ) );
81 
82  m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
83  KiBitmap( zoom_redraw_xpm ),
84  _( "Redraw view" ) );
85 
86  m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
87  _( "Zoom to fit 3D model" ) );
88 
89  m_mainToolBar->AddSeparator();
90  m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
91  KiBitmap( rotate_neg_x_xpm ),
92  _( "Rotate X Clockwise" ) );
93 
94  m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
95  KiBitmap( rotate_pos_x_xpm ),
96  _( "Rotate X Counterclockwise" ) );
97 
98  m_mainToolBar->AddSeparator();
99  m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
100  KiBitmap( rotate_neg_y_xpm ),
101  _( "Rotate Y Clockwise" ) );
102 
103  m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
104  KiBitmap( rotate_pos_y_xpm ),
105  _( "Rotate Y Counterclockwise" ) );
106 
107  m_mainToolBar->AddSeparator();
108  m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
109  KiBitmap( rotate_neg_z_xpm ),
110  _( "Rotate Z Clockwise" ) );
111 
112  m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
113  KiBitmap( rotate_pos_z_xpm ),
114  _( "Rotate Z Counterclockwise" ) );
115 
116  m_mainToolBar->AddSeparator();
117  m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
118  _( "Move left" ) );
119 
120  m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
121  _( "Move right" ) );
122 
123  m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
124  _( "Move up" ) );
125 
126  m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
127  _( "Move down" ) );
128 
129  m_mainToolBar->AddSeparator();
130  m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
131  _( "Enable/Disable orthographic projection" ),
132  wxITEM_CHECK );
133 
134  m_mainToolBar->Realize();
135 }
136 
137 
139 {
140 }
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:138
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars