KiCad PCB EDA Suite
dialog_non_copper_zones_properties.cpp
Go to the documentation of this file.
1 
4 /*
5  * This program source code file is part of KiCad, a free EDA CAD application.
6  *
7  * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
8  * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
9  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, you may find one here:
23  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24  * or you may search the http://www.gnu.org website for the version 2 license,
25  * or you may write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27  */
28 
29 #include <fctsys.h>
30 #include <kiface_i.h>
31 #include <confirm.h>
32 #include <pcb_edit_frame.h>
33 #include <widgets/unit_binder.h>
34 #include <class_zone.h>
35 #include <zones.h>
36 
38 
39 
41 {
42 private:
45  ZONE_SETTINGS m_settings; // working copy of zone settings
47 
48  bool TransferDataToWindow() override;
49  bool TransferDataFromWindow() override;
50 
51  void OnLayerSelection( wxDataViewEvent& event ) override;
52 
53 public:
55 };
56 
57 
59 {
60  DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aSettings );
61 
62  return dlg.ShowModal();
63 }
64 
65 
67  ZONE_SETTINGS* aSettings ) :
70 {
71  m_parent = aParent;
72 
73  m_ptr = aSettings;
74  m_settings = *aSettings;
76 
78 }
79 
80 
82 {
85 
87  {
88  case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break;
89  case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break;
90  case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break;
91  }
92 
93  return true;
94 }
95 
96 
98 {
99  if( event.GetColumn() != 0 )
100  return;
101 
102  int row = m_layers->ItemToRow( event.GetItem() );
103 
104  if( m_layers->GetToggleValue( row, 0 ) )
105  {
106  wxVariant layerID;
107  m_layers->GetValue( layerID, row, 2 );
108  m_settings.m_CurrentZone_Layer = ToLAYER_ID( layerID.GetInteger() );
109 
110  // Turn all other checkboxes off.
111  for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
112  {
113  if( ii != row )
114  m_layers->SetToggleValue( false, ii, 0 );
115  }
116  }
117 }
118 
119 
121 {
123 
124  m_settings.m_FillMode = ZFM_POLYGONS; // Use always polygon fill mode
125 
126  switch( m_OutlineAppearanceCtrl->GetSelection() )
127  {
131  }
132 
133  wxConfigBase* cfg = Kiface().KifaceSettings();
134  wxASSERT( cfg );
135 
137 
139 
140  // Get the layer selection for this zone
141  int layer = -1;
142  for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
143  {
144  if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
145  {
146  layer = ii;
147  break;
148  }
149  }
150 
151  if( layer < 0 )
152  {
153  DisplayError( this, _( "No layer selected." ) );
154  return false;
155  }
156 
157  *m_ptr = m_settings;
158  return true;
159 }
160 
161 
int m_Zone_HatchingStyle
Option to show the zone area (outlines only, short hatches or full hatches.
Definition: zone_settings.h:72
This file is part of the common library.
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing...
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Classes to handle copper zones.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void SetupLayersList(wxDataViewListCtrl *aList, PCB_BASE_FRAME *aFrame, bool aShowCopper)
A helper routine for the various zone dialogs (copper, non-copper, keepout).
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
Class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE.
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:48
ZONE_FILL_MODE m_FillMode
Definition: zone_settings.h:59
DIALOG_NON_COPPER_ZONES_EDITOR(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
#define IU_PER_MILS
Definition: plotter.cpp:134
void OnLayerSelection(wxDataViewEvent &event) override
#define ZONE_NET_OUTLINES_STYLE_KEY
Definition: zones.h:29
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:69
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
int m_ZoneMinThickness
Min thickness value in filled areas.
Definition: zone_settings.h:64