2014-10-19 22:17:43 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-12-28 08:29:56 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2019-01-13 19:04:34 +00:00
|
|
|
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-19 22:17:43 +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
|
|
|
|
*/
|
2013-05-25 09:01:44 +00:00
|
|
|
|
|
|
|
#include "dialog_3D_view_option_base.h"
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <3d_viewer/eda_3d_viewer.h>
|
2020-03-26 14:05:20 +00:00
|
|
|
#include <3d_canvas/board_adapter.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2013-05-25 09:01:44 +00:00
|
|
|
|
|
|
|
class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE
|
|
|
|
{
|
|
|
|
public:
|
2020-04-05 23:31:45 +00:00
|
|
|
explicit DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* aParent );
|
2013-05-25 09:01:44 +00:00
|
|
|
|
|
|
|
private:
|
2020-03-26 14:05:20 +00:00
|
|
|
BOARD_ADAPTER& m_settings;
|
2013-05-25 09:01:44 +00:00
|
|
|
|
|
|
|
void initDialog();
|
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
/// Automatically called when clicking on the OK button
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
|
|
|
/// Automatically called after creating the dialog
|
|
|
|
bool TransferDataToWindow() override;
|
2013-05-25 09:01:44 +00:00
|
|
|
};
|
|
|
|
|
2015-03-26 19:04:52 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
|
2013-05-25 09:01:44 +00:00
|
|
|
{
|
|
|
|
DIALOG_3D_VIEW_OPTIONS dlg( this );
|
2015-03-26 19:04:52 +00:00
|
|
|
|
2013-05-25 09:01:44 +00:00
|
|
|
if( dlg.ShowModal() == wxID_OK )
|
|
|
|
{
|
2018-04-06 16:00:58 +00:00
|
|
|
NewDisplay( true );
|
2013-05-25 09:01:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-05 23:31:45 +00:00
|
|
|
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* aParent ) :
|
|
|
|
DIALOG_3D_VIEW_OPTIONS_BASE( aParent ),
|
|
|
|
m_settings( aParent->GetAdapter() )
|
2013-05-25 09:01:44 +00:00
|
|
|
{
|
|
|
|
initDialog();
|
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
FinishDialogSettings();
|
2013-05-25 09:01:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 22:17:43 +00:00
|
|
|
|
2013-05-25 09:01:44 +00:00
|
|
|
void DIALOG_3D_VIEW_OPTIONS::initDialog()
|
|
|
|
{
|
2017-12-28 08:29:56 +00:00
|
|
|
m_bitmapRealisticMode->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
|
2017-12-28 13:14:46 +00:00
|
|
|
m_bitmapBoardBody->SetBitmap( KiBitmap( ortho_xpm ) );
|
2013-05-25 09:01:44 +00:00
|
|
|
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
|
2017-12-28 08:29:56 +00:00
|
|
|
m_bitmap3DshapesTH->SetBitmap( KiBitmap( shape_3d_xpm ) );
|
|
|
|
m_bitmap3DshapesSMD->SetBitmap( KiBitmap( shape_3d_xpm ) );
|
|
|
|
m_bitmap3DshapesVirtual->SetBitmap( KiBitmap( shape_3d_xpm ) );
|
2017-12-28 13:14:46 +00:00
|
|
|
m_bitmapBoundingBoxes->SetBitmap( KiBitmap( axis3d_xpm ) );
|
2013-05-25 09:01:44 +00:00
|
|
|
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
m_bitmapSilkscreen->SetBitmap( KiBitmap( text_xpm ) );
|
2013-05-25 09:01:44 +00:00
|
|
|
m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
|
|
|
|
m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
|
|
|
|
m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
m_bitmapComments->SetBitmap( KiBitmap( editor_xpm ) );
|
|
|
|
m_bitmapECO->SetBitmap( KiBitmap( editor_xpm ) );
|
2020-01-29 16:00:05 +00:00
|
|
|
m_bitmapSubtractMaskFromSilk->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
|
2017-12-28 08:29:56 +00:00
|
|
|
}
|
2013-05-25 09:01:44 +00:00
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
|
|
|
|
bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
|
|
|
|
{
|
2013-05-25 09:01:44 +00:00
|
|
|
// Check/uncheck checkboxes
|
2020-03-24 01:01:23 +00:00
|
|
|
m_checkBoxRealisticMode->SetValue( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
|
|
|
|
m_checkBoxBoardBody->SetValue( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
|
|
|
|
m_checkBoxCuThickness->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
|
|
|
m_checkBoxAreas->SetValue( m_settings.GetFlag( FL_ZONE ) );
|
|
|
|
m_checkBoxBoundingBoxes->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
|
|
|
|
|
|
|
m_checkBox3DshapesTH->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
|
|
|
|
m_checkBox3DshapesSMD->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
|
|
|
|
m_checkBox3DshapesVirtual->SetValue( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
|
|
|
|
|
|
|
|
m_checkBoxSilkscreen->SetValue( m_settings.GetFlag( FL_SILKSCREEN ) );
|
|
|
|
m_checkBoxSolderMask->SetValue( m_settings.GetFlag( FL_SOLDERMASK ) );
|
|
|
|
m_checkBoxSolderpaste->SetValue( m_settings.GetFlag( FL_SOLDERPASTE ) );
|
|
|
|
m_checkBoxAdhesive->SetValue( m_settings.GetFlag( FL_ADHESIVE ) );
|
|
|
|
m_checkBoxComments->SetValue( m_settings.GetFlag( FL_COMMENTS ) );
|
|
|
|
m_checkBoxECO->SetValue( m_settings.GetFlag( FL_ECO ) );
|
|
|
|
m_checkBoxSubtractMaskFromSilk->SetValue( m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) );
|
2014-10-19 22:17:43 +00:00
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
return true;
|
2013-05-25 09:01:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 22:17:43 +00:00
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow()
|
2013-05-25 09:01:44 +00:00
|
|
|
{
|
2017-12-28 08:29:56 +00:00
|
|
|
// Set render mode
|
2020-03-24 01:01:23 +00:00
|
|
|
m_settings.SetFlag( FL_USE_REALISTIC_MODE, m_checkBoxRealisticMode->GetValue() );
|
2013-05-25 09:01:44 +00:00
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
// Set visibility of items
|
2020-03-24 01:01:23 +00:00
|
|
|
m_settings.SetFlag( FL_SHOW_BOARD_BODY, m_checkBoxBoardBody->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, m_checkBoxBoundingBoxes->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, m_checkBoxSubtractMaskFromSilk->GetValue() );
|
2017-12-28 08:29:56 +00:00
|
|
|
|
|
|
|
// Set 3D shapes visibility
|
2020-03-24 01:01:23 +00:00
|
|
|
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, m_checkBox3DshapesTH->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, m_checkBox3DshapesSMD->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, m_checkBox3DshapesVirtual->GetValue() );
|
2017-12-28 08:29:56 +00:00
|
|
|
|
|
|
|
// Set Layer visibility
|
2020-03-24 01:01:23 +00:00
|
|
|
m_settings.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_SOLDERMASK, m_checkBoxSolderMask->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_SOLDERPASTE, m_checkBoxSolderpaste->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_ADHESIVE, m_checkBoxAdhesive->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_COMMENTS, m_checkBoxComments->GetValue() );
|
|
|
|
m_settings.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
|
2013-05-25 09:01:44 +00:00
|
|
|
|
2017-12-28 08:29:56 +00:00
|
|
|
return true;
|
2013-05-25 09:01:44 +00:00
|
|
|
}
|