forked from jpt13653903/FreePCB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DlgAddArea.cpp
110 lines (97 loc) · 2.5 KB
/
DlgAddArea.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// DlgAddArea.cpp : implementation file
//
#include "stdafx.h"
#include "FreePcb.h"
#include "DlgAddArea.h"
#include "layers.h"
// globals
int gHatch = CPolyLine::NO_HATCH;
// CDlgAddArea dialog
IMPLEMENT_DYNAMIC(CDlgAddArea, CDialog)
CDlgAddArea::CDlgAddArea(CWnd* pParent /*=NULL*/)
: CDialog(CDlgAddArea::IDD, pParent)
{
}
CDlgAddArea::~CDlgAddArea()
{
}
void CDlgAddArea::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO_NET, m_combo_net);
DDX_Control(pDX, IDC_LIST_LAYER, m_list_layer);
DDX_Control(pDX, IDC_RADIO_NONE, m_radio_none);
DDX_Control(pDX, IDC_RADIO_FULL, m_radio_full);
DDX_Control(pDX, IDC_RADIO_EDGE, m_radio_edge);
if( !pDX->m_bSaveAndValidate )
{
// incoming, initialize net list
cnet * net = m_nlist->GetFirstNet();
while( net )
{
m_combo_net.AddString( net->name );
net = m_nlist->GetNextNet();
}
if( m_net )
{
bNewArea = FALSE;
int i = m_combo_net.SelectString( -1, m_net->name );
if( i == CB_ERR )
ASSERT(0);
}
else
bNewArea = TRUE;
// initialize layers
m_num_layers = m_num_layers-LAY_TOP_COPPER;
for( int il=0; il<m_num_layers; il++ )
{
m_list_layer.InsertString( il, &layer_str[il+LAY_TOP_COPPER][0] );
}
m_list_layer.SetCurSel( m_layer - LAY_TOP_COPPER );
if( m_hatch == -1 )
m_hatch = gHatch;
if( m_hatch == CPolyLine::NO_HATCH )
m_radio_none.SetCheck( 1 );
else if( m_hatch == CPolyLine::DIAGONAL_EDGE )
m_radio_edge.SetCheck( 1 );
else if( m_hatch == CPolyLine::DIAGONAL_FULL )
m_radio_full.SetCheck( 1 );
}
else
{
// outgoing
m_layer = m_list_layer.GetCurSel() + LAY_TOP_COPPER;
m_combo_net.GetWindowText( m_net_name );
POSITION pos;
CString name;
void * ptr;
m_net = m_nlist->GetNetPtrByName( &m_net_name );
if( !m_net )
{
AfxMessageBox( "Illegal net name" );
pDX->Fail();
}
if( m_radio_none.GetCheck() )
m_hatch = CPolyLine::NO_HATCH;
else if( m_radio_full.GetCheck() )
m_hatch = CPolyLine::DIAGONAL_FULL;
else if( m_radio_edge.GetCheck() )
m_hatch = CPolyLine::DIAGONAL_EDGE;
else
ASSERT(0);
if( bNewArea )
gHatch = m_hatch;
}
}
BEGIN_MESSAGE_MAP(CDlgAddArea, CDialog)
END_MESSAGE_MAP()
// CDlgAddArea message handlers
void CDlgAddArea::Initialize( CNetList * nl, int nlayers,
cnet * net, int layer, int hatch )
{
m_nlist = nl;
m_num_layers = nlayers;
m_net = net;
m_layer = layer;
m_hatch = hatch;
}