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  wxWindowUpdateLocker dummy( this );
44 
45  if( m_mainToolBar )
46  {
47  m_mainToolBar->Clear();
48  }
49  else
50  {
51  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
52  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
53  }
54 
55  // Set up toolbar
56  m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
57  KiScaledBitmap( import3d_xpm, this ), _( "Reload board" ) );
58 
60 
61  m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
62  KiScaledBitmap( copy_xpm, this ),
63  _( "Copy 3D image to clipboard" ) );
64 
66 
67  m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
68  KiScaledBitmap( read_setup_xpm, this ),
69  _( "Set display options, and some layers visibility" ) );
70  m_mainToolBar->AddSeparator();
71 
72  m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
73  KiScaledBitmap( render_mode_xpm, this ),
74  _( "Render current view using Raytracing" ), wxITEM_CHECK );
75 
77 
78  m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
79  KiScaledBitmap( zoom_in_xpm, this ),
80  _( "Zoom in" ) );
81 
82  m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
83  KiScaledBitmap( zoom_out_xpm, this ),
84  _( "Zoom out" ) );
85 
86  m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
87  KiScaledBitmap( zoom_redraw_xpm, this ),
88  _( "Redraw view" ) );
89 
90  m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
91  KiScaledBitmap( zoom_fit_in_page_xpm, this ),
92  _( "Zoom to fit 3D model" ) );
93 
95 
96  m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
97  KiScaledBitmap( rotate_neg_x_xpm, this ),
98  _( "Rotate X Clockwise" ) );
99 
100  m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
101  KiScaledBitmap( rotate_pos_x_xpm, this ),
102  _( "Rotate X Counterclockwise" ) );
103 
105 
106  m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
107  KiScaledBitmap( rotate_neg_y_xpm, this ),
108  _( "Rotate Y Clockwise" ) );
109 
110  m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
111  KiScaledBitmap( rotate_pos_y_xpm, this ),
112  _( "Rotate Y Counterclockwise" ) );
113 
115 
116  m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
117  KiScaledBitmap( rotate_neg_z_xpm, this ),
118  _( "Rotate Z Clockwise" ) );
119 
120  m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
121  KiScaledBitmap( rotate_pos_z_xpm, this ),
122  _( "Rotate Z Counterclockwise" ) );
123 
125 
126  m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString,
127  KiScaledBitmap( left_xpm, this ),
128  _( "Move left" ) );
129 
130  m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString,
131  KiScaledBitmap( right_xpm, this ),
132  _( "Move right" ) );
133 
134  m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString,
135  KiScaledBitmap( up_xpm, this ),
136  _( "Move up" ) );
137 
138  m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString,
139  KiScaledBitmap( down_xpm, this ),
140  _( "Move down" ) );
141 
143 
144  m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString,
145  KiScaledBitmap( ortho_xpm, this ),
146  _( "Enable/Disable orthographic projection" ),
147  wxITEM_CHECK );
148 
149  m_mainToolBar->Realize();
150 }
Definition: id.h:235
Handles data related with the board to be visualized.
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, EDA_BASE_FRAME *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
wxAuiToolBar * m_mainToolBar
void ReCreateMainToolbar()
Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar.
Definition: 3d_toolbar.cpp:39
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 when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars