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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.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 
41  // Event functions:
42  void OnShowAllClick( wxCommandEvent& event ) override;
43  void OnShowNoneClick( wxCommandEvent& event ) override;
44  void OnOKClick( wxCommandEvent& event ) override;
45 };
46 
47 
48 void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event )
49 {
50  DIALOG_3D_VIEW_OPTIONS dlg( this );
51 
52  if( dlg.ShowModal() == wxID_OK )
53  {
55  NewDisplay();
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  SetDefaultItem( m_sdbSizerOK );
68  Layout();
69  GetSizer()->SetSizeHints( this );
70  Centre();
71 }
72 
73 
75 {
76  m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
77  m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
78  m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
79  m_bitmapSilkscreen->SetBitmap( KiBitmap( text_xpm ) );
80  m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
81  m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
82  m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
83  m_bitmapComments->SetBitmap( KiBitmap( editor_xpm ) );
84  m_bitmapECO->SetBitmap( KiBitmap( editor_xpm ) );
85 
86  // Check/uncheck checkboxes
87  m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
93  m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
94 }
95 
96 
97 void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
98 {
99  bool state = true;
100  m_checkBoxCuThickness->SetValue( state );
101  //m_checkBox3Dshapes->SetValue( state );
102  m_checkBoxAreas->SetValue( state );
103  m_checkBoxSilkscreen->SetValue( state );
104  m_checkBoxSolderMask->SetValue( state );
105  m_checkBoxSolderpaste->SetValue( state );
106  m_checkBoxAdhesive->SetValue( state );
107  m_checkBoxComments->SetValue( state );
108  m_checkBoxECO->SetValue( state );
109 }
110 
111 
112 void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
113 {
114  bool state = false;
115  m_checkBoxCuThickness->SetValue( state );
116  //m_checkBox3Dshapes->SetValue( state );
117  m_checkBoxAreas->SetValue( state );
118  m_checkBoxSilkscreen->SetValue( state );
119  m_checkBoxSolderMask->SetValue( state );
120  m_checkBoxSolderpaste->SetValue( state );
121  m_checkBoxAdhesive->SetValue( state );
122  m_checkBoxComments->SetValue( state );
123  m_checkBoxECO->SetValue( state );
124 }
125 
126 
127 void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
128 {
129  m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
135  m_3Dprms.SetFlag( FL_ECO, m_checkBoxECO->GetValue( ) );
136 
137  EndModal( wxID_OK );
138 }
void Install3DViewOptionDialog(wxCommandEvent &event)
void OnShowNoneClick(wxCommandEvent &event) override
void SetMenuBarOptionsState()
Set the state of toggle menus according to the current display options.
Definition: 3d_toolbar.cpp:414
DIALOG_3D_VIEW_OPTIONS(EDA_3D_VIEWER *parent)
Class DIALOG_3D_VIEW_OPTIONS_BASE.
Handles data related with the board to be visualized.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
Class CINFO3D_VISU Helper class to handle information needed to display 3D board. ...
Definition: cinfo3d_visu.h:70
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
Declaration of the eda_3d_viewer class.
Class EDA_3D_VIEWER Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard...
Definition: eda_3d_viewer.h:50
static const char * text_xpm[]
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
void OnShowAllClick(wxCommandEvent &event) override
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
void OnOKClick(wxCommandEvent &event) override