2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file 3d_toolbar.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <3d_viewer.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
void EDA_3D_FRAME::ReCreateHToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-09 02:21:43 +00:00
|
|
|
if( m_HToolBar != NULL )
|
2009-11-04 20:46:53 +00:00
|
|
|
{
|
|
|
|
// Simple update to the list of old files.
|
2007-09-09 02:21:43 +00:00
|
|
|
SetToolbars();
|
|
|
|
return;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_HToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
// Set up toolbar
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( import3d_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Reload board" ) );
|
2011-09-17 15:31:21 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
|
|
|
|
|
|
|
// Does not work properly under linux
|
|
|
|
m_HToolBar->AddSeparator();
|
2007-09-09 02:21:43 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( copy_button_xpm ),
|
2009-11-04 20:46:53 +00:00
|
|
|
_( "Copy 3D Image to Clipboard" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Zoom in" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Zoom out" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( zoom_redraw_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Redraw view" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
2011-03-20 17:10:38 +00:00
|
|
|
_( "Fit in page" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_neg_x_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate X <-" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_pos_x_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate X ->" ) );
|
2007-06-14 18:39:36 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_neg_y_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate Y <-" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_pos_y_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate Y ->" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_neg_z_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate Z <-" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
|
2011-08-29 03:04:59 +00:00
|
|
|
KiBitmap( rotate_pos_z_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Rotate Z ->" ) );
|
2007-06-14 18:39:36 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Move left <-" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
|
2009-04-05 20:49:15 +00:00
|
|
|
_( "Move right ->" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
|
2009-11-04 20:46:53 +00:00
|
|
|
_( "Move up ^" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
|
2010-11-01 18:33:44 +00:00
|
|
|
_( "Move down v" ) );
|
|
|
|
|
2010-10-04 12:58:07 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
|
2010-11-01 18:33:44 +00:00
|
|
|
_( "Enable/Disable orthographic projection" ),
|
2010-10-04 12:58:07 +00:00
|
|
|
wxITEM_CHECK );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
m_HToolBar->Realize();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
void EDA_3D_FRAME::ReCreateVToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
void EDA_3D_FRAME::ReCreateMenuBar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
bool full_options = true;
|
2008-08-17 18:37:03 +00:00
|
|
|
|
2011-10-13 19:56:32 +00:00
|
|
|
// If called from the display frame of CvPcb, only some options are relevant
|
2012-02-25 19:55:40 +00:00
|
|
|
if( Parent()->GetName() == wxT( "CmpFrame" ) )
|
2011-10-13 19:56:32 +00:00
|
|
|
// Called from CvPcb: do not display all options
|
2010-10-04 11:50:43 +00:00
|
|
|
full_options = false;
|
2008-08-17 18:37:03 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
wxMenuBar* menuBar = new wxMenuBar;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
wxMenu* fileMenu = new wxMenu;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
|
|
|
|
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
|
2010-10-04 11:50:43 +00:00
|
|
|
|
|
|
|
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
|
|
|
// Does not work properly under linux
|
|
|
|
fileMenu->AppendSeparator();
|
2011-09-17 15:31:21 +00:00
|
|
|
fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, _( "Copy 3D Image to Clipboard" ) );
|
2010-10-04 11:50:43 +00:00
|
|
|
#endif
|
2007-09-09 02:21:43 +00:00
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
wxMenu* referencesMenu = new wxMenu;
|
|
|
|
menuBar->Append( referencesMenu, _( "&Preferences" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_BGCOLOR_SELECTION,
|
|
|
|
_( "Choose background color" ), KiBitmap( palette_xpm ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_AXIS_ONOFF,
|
|
|
|
_( "3D Axis On/Off" ), KiBitmap( axis3d_front_xpm ) );
|
2008-08-16 17:42:40 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
if( full_options )
|
2008-08-17 18:37:03 +00:00
|
|
|
{
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_MODULE_ONOFF,
|
|
|
|
_( "3D Footprints Shapes On/Off" ), KiBitmap( shape_3d_xpm ) );
|
2008-08-16 17:42:40 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_ZONE_ONOFF,
|
|
|
|
_( "Zone Filling On/Off" ), KiBitmap( add_zone_xpm ) );
|
2008-08-17 18:37:03 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
|
|
|
|
_( "Comments Layer On/Off" ), KiBitmap( edit_sheet_xpm ) );
|
2008-08-16 17:42:40 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
|
|
|
|
_( "Drawings Layer On/Off" ), KiBitmap( add_polygon_xpm ) );
|
2008-08-16 17:42:40 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_ECO1_ONOFF,
|
|
|
|
_( "Eco1 Layer On/Off" ), KiBitmap( tools_xpm ) );
|
2008-08-16 17:42:40 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( referencesMenu, ID_MENU3D_ECO2_ONOFF,
|
|
|
|
_( "Eco2 Layer On/Off" ), KiBitmap( tools_xpm ) );
|
2009-11-04 20:46:53 +00:00
|
|
|
}
|
2007-09-09 02:21:43 +00:00
|
|
|
|
|
|
|
SetMenuBar( menuBar );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-09 02:21:43 +00:00
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
void EDA_3D_FRAME::SetToolbars()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|