2016-07-19 17:35:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-03-16 12:38:36 +00:00
|
|
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
2022-06-06 20:58:00 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-07-19 17:35:25 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-03-18 22:48:36 +00:00
|
|
|
#include <wx/wupdlock.h>
|
2022-06-06 20:58:00 +00:00
|
|
|
#include <wx/choice.h>
|
2021-03-07 20:31:19 +00:00
|
|
|
|
|
|
|
#include <bitmaps.h>
|
2022-10-27 10:32:52 +00:00
|
|
|
#include <dialogs/eda_view_switcher.h>
|
2021-08-05 12:03:59 +00:00
|
|
|
#include <eda_3d_viewer_frame.h>
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <menus_helpers.h>
|
2020-03-18 22:48:36 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2021-06-19 17:28:45 +00:00
|
|
|
#include <tools/eda_3d_actions.h>
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <3d_viewer_id.h>
|
|
|
|
|
2021-06-19 17:28:45 +00:00
|
|
|
void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
2016-07-19 17:35:25 +00:00
|
|
|
{
|
2022-02-04 20:21:07 +00:00
|
|
|
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::ReCreateMainToolbar" ) );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2019-04-08 12:19:17 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
|
|
|
|
|
|
|
if( m_mainToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_mainToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2019-04-08 12:19:17 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2020-11-06 01:56:02 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_mainToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2022-07-29 16:31:49 +00:00
|
|
|
// Show the hotkey to open the windows list selector:
|
2022-10-27 10:32:52 +00:00
|
|
|
wxString keyName = KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY );
|
|
|
|
|
|
|
|
m_viewportsLabel = new wxStaticText( m_mainToolBar, wxID_ANY,
|
2022-10-27 17:03:07 +00:00
|
|
|
wxString::Format( _( "Viewports (%s+Tab):" ), keyName ) );
|
2022-06-06 20:58:00 +00:00
|
|
|
m_viewportsLabel->Wrap( -1 );
|
|
|
|
|
2022-07-29 16:31:49 +00:00
|
|
|
m_cbViewports = new wxChoice( m_mainToolBar, wxID_ANY );
|
2022-06-06 20:58:00 +00:00
|
|
|
|
|
|
|
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
|
|
|
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
|
|
|
|
|
2022-08-28 22:25:01 +00:00
|
|
|
m_cbViewports->Append( wxT( "---" ) );
|
2022-06-06 20:58:00 +00:00
|
|
|
m_cbViewports->Append( _( "Save viewport..." ) );
|
|
|
|
m_cbViewports->Append( _( "Delete viewport..." ) );
|
|
|
|
|
2022-10-27 10:32:52 +00:00
|
|
|
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore view orientation and zoom.\n"
|
2022-10-27 17:03:07 +00:00
|
|
|
"Use %s+Tab to activate selector.\n"
|
2022-10-27 10:32:52 +00:00
|
|
|
"Successive Tabs while holding %s down will "
|
|
|
|
"cycle through viewports in the popup." ),
|
|
|
|
keyName, keyName ) );
|
2022-10-27 10:05:42 +00:00
|
|
|
|
2022-06-06 20:58:00 +00:00
|
|
|
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
|
2022-10-27 10:05:42 +00:00
|
|
|
|
2022-06-06 20:58:00 +00:00
|
|
|
m_lastSelectedViewport = nullptr;
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
// Set up toolbar
|
|
|
|
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::import3d, this ), _( "Reload board" ) );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2016-07-19 17:35:25 +00:00
|
|
|
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::copy, this ),
|
2016-07-19 17:35:25 +00:00
|
|
|
_( "Copy 3D image to clipboard" ) );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-04-08 12:19:17 +00:00
|
|
|
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::render_mode, this ),
|
2019-01-19 13:02:10 +00:00
|
|
|
_( "Render current view using Raytracing" ), wxITEM_CHECK );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-06-08 21:35:40 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
|
2019-04-08 12:19:17 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-03-18 22:48:36 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2021-08-21 17:06:42 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::showTHT, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::showSMD, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::showVirtual, ACTION_TOOLBAR::TOGGLE );
|
2022-09-24 09:25:02 +00:00
|
|
|
m_mainToolBar->Add( EDA_3D_ACTIONS::showNotInPosFile, ACTION_TOOLBAR::TOGGLE );
|
2021-08-21 17:06:42 +00:00
|
|
|
|
2022-06-06 20:58:00 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
m_mainToolBar->AddControl( m_viewportsLabel );
|
|
|
|
m_mainToolBar->AddControl( m_cbViewports );
|
|
|
|
|
2020-11-06 01:56:02 +00:00
|
|
|
m_mainToolBar->KiRealize();
|
2020-03-18 22:48:36 +00:00
|
|
|
}
|
2022-06-06 20:58:00 +00:00
|
|
|
|
|
|
|
|