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-2021 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 
27 #include <wx/wupdlock.h>
28 
29 #include <bitmaps.h>
30 #include <eda_3d_viewer_frame.h>
31 #include <menus_helpers.h>
32 #include <tool/action_toolbar.h>
33 #include <tools/eda_3d_actions.h>
34 #include <3d_viewer_id.h>
35 
ReCreateMainToolbar()36 void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
37 {
38     wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::ReCreateMainToolbar" );
39 
40     wxWindowUpdateLocker dummy( this );
41 
42     if( m_mainToolBar )
43     {
44         m_mainToolBar->ClearToolbar();
45     }
46     else
47     {
48         m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
49                                             KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
50         m_mainToolBar->SetAuiManager( &m_auimgr );
51     }
52 
53     // Set up toolbar
54     m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
55                             KiScaledBitmap( BITMAPS::import3d, this ), _( "Reload board" ) );
56 
57     m_mainToolBar->AddScaledSeparator( this );
58     m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
59                             KiScaledBitmap( BITMAPS::copy, this ),
60                             _( "Copy 3D image to clipboard" ) );
61 
62     m_mainToolBar->AddScaledSeparator( this );
63     m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
64                             KiScaledBitmap( BITMAPS::render_mode, this ),
65                             _( "Render current view using Raytracing" ), wxITEM_CHECK );
66 
67     m_mainToolBar->AddScaledSeparator( this );
68     m_mainToolBar->Add( ACTIONS::zoomRedraw );
69     m_mainToolBar->Add( ACTIONS::zoomInCenter );
70     m_mainToolBar->Add( ACTIONS::zoomOutCenter );
71     m_mainToolBar->Add( ACTIONS::zoomFitScreen );
72 
73     m_mainToolBar->AddScaledSeparator( this );
74     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
75     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
76 
77     m_mainToolBar->AddScaledSeparator( this );
78     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
79     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
80 
81     m_mainToolBar->AddScaledSeparator( this );
82     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
83     m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
84 
85     m_mainToolBar->AddScaledSeparator( this );
86     m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
87 
88     m_mainToolBar->AddScaledSeparator( this );
89     m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
90     m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
91     m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
92     m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
93 
94     m_mainToolBar->AddScaledSeparator( this );
95     m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
96 
97     m_mainToolBar->AddScaledSeparator( this );
98     m_mainToolBar->Add( EDA_3D_ACTIONS::showTHT, ACTION_TOOLBAR::TOGGLE );
99     m_mainToolBar->Add( EDA_3D_ACTIONS::showSMD, ACTION_TOOLBAR::TOGGLE );
100     m_mainToolBar->Add( EDA_3D_ACTIONS::showVirtual, ACTION_TOOLBAR::TOGGLE );
101 
102     m_mainToolBar->KiRealize();
103 }
104