KiCad PCB EDA Suite
dialog_3D_view_option.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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
27 #include <3d_canvas/cinfo3d_visu.h>
28 #include <bitmaps.h>
29 
31 {
32 public:
33  explicit DIALOG_3D_VIEW_OPTIONS( EDA_3D_VIEWER* parent );
34 
35 private:
38 
39  void initDialog();
40 
42  bool TransferDataFromWindow() override;
43 
45  bool TransferDataToWindow() override;
46 };
47 
48 
49 void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
50 {
51  DIALOG_3D_VIEW_OPTIONS dlg( this );
52 
53  if( dlg.ShowModal() == wxID_OK )
54  {
55  NewDisplay( true );
56  }
57 }
58 
59 
61  :DIALOG_3D_VIEW_OPTIONS_BASE( parent ), m_3Dprms( parent->GetSettings() )
62 {
63  m_parent = parent;
64 
65  initDialog();
66 
67  m_sdbSizerOK->SetDefault();
68 
69  // Now all widgets have the size fixed, call FinishDialogSettings
71 }
72 
73 
75 {
77  m_bitmapBoardBody->SetBitmap( KiBitmap( ortho_xpm ) );
79  m_bitmap3DshapesTH->SetBitmap( KiBitmap( shape_3d_xpm ) );
80  m_bitmap3DshapesSMD->SetBitmap( KiBitmap( shape_3d_xpm ) );
82  m_bitmapBoundingBoxes->SetBitmap( KiBitmap( axis3d_xpm ) );
83  m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
84  m_bitmapSilkscreen->SetBitmap( KiBitmap( text_xpm ) );
87  m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
88  m_bitmapComments->SetBitmap( KiBitmap( editor_xpm ) );
89  m_bitmapECO->SetBitmap( KiBitmap( editor_xpm ) );
91 }
92 
93 
95 {
96  // Check/uncheck checkboxes
100  m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
102 
106 
112  m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
114 
115  return true;
116 }
117 
118 
120 {
121  // Set render mode
123 
124  // Set visibility of items
127  m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
130 
131  // Set 3D shapes visibility
135 
136  // Set Layer visibility
142  m_3Dprms.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
143 
144  return true;
145 }
void Install3DViewOptionDialog(wxCommandEvent &event)
const BITMAP_OPAQUE editor_xpm[1]
Definition: editor.cpp:83
DIALOG_3D_VIEW_OPTIONS(EDA_3D_VIEWER *parent)
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class DIALOG_3D_VIEW_OPTIONS_BASE.
const BITMAP_OPAQUE ortho_xpm[1]
Definition: ortho.cpp:55
const BITMAP_OPAQUE text_xpm[1]
Definition: text.cpp:27
Handles data related with the board to be visualized.
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
bool TransferDataToWindow() override
Automatically called after creating the dialog.
Class CINFO3D_VISU Helper class to handle information needed to display 3D board.
Definition: cinfo3d_visu.h:73
const BITMAP_OPAQUE shape_3d_xpm[1]
Definition: shape_3d.cpp:35
const BITMAP_OPAQUE axis3d_xpm[1]
Definition: axis3d.cpp:91
const BITMAP_OPAQUE tools_xpm[1]
Definition: tools.cpp:113
const BITMAP_OPAQUE pads_mask_layers_xpm[1]
Declaration of the eda_3d_viewer class.
const BITMAP_OPAQUE use_3D_copper_thickness_xpm[1]
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:74
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:65
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
bool TransferDataFromWindow() override
Automatically called when clicking on the OK button.