forked from nkhorman/archive-freepcb-atlassian
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDlgImportOptions.cpp
140 lines (128 loc) · 4.11 KB
/
DlgImportOptions.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// DlgImportOptions.cpp : implementation file
//
#include "stdafx.h"
#include "FreePcb.h"
#include "DlgImportOptions.h"
#include ".\dlgimportoptions.h"
// CDlgImportOptions dialog
IMPLEMENT_DYNAMIC(CDlgImportOptions, CDialog)
CDlgImportOptions::CDlgImportOptions(CWnd* pParent /*=NULL*/)
: CDialog(CDlgImportOptions::IDD, pParent)
{
}
CDlgImportOptions::~CDlgImportOptions()
{
}
void CDlgImportOptions::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_RADIO_REMOVE_PARTS, m_radio_remove_parts);
DDX_Control(pDX, IDC_RADIO_KEEP_PARTS_NO_CONNECTIONS, m_radio_keep_parts_no_connections);
DDX_Control(pDX, IDC_RADIO_KEEP_PARTS_AND_CONNECTIONS, m_radio_keep_parts_and_connections);
DDX_Control(pDX, IDC_RADIO4, m_radio_change_fp);
DDX_Control(pDX, IDC_RADIO3, m_radio_keep_fp);
DDX_Control(pDX, IDC_RADIO6, m_radio_remove_nets);
DDX_Control(pDX, IDC_RADIO5, m_radio_keep_nets);
DDX_Control(pDX, IDC_CHECK_KEEP_TRACES, m_check_keep_traces);
DDX_Control(pDX, IDC_CHECK_KEEP_STUBS, m_check_keep_stubs);
DDX_Control(pDX, IDC_CHECK_KEEP_AREAS, m_check_keep_areas);
DDX_Control(pDX, ID_SAVE_AND_IMPORT, m_button_save_and_import);
if( !pDX->m_bSaveAndValidate )
{
// incoming
if( m_flags & IMPORT_PARTS )
{
m_radio_remove_parts.EnableWindow( 1 );
m_radio_keep_parts_no_connections.EnableWindow( 1 );
m_radio_keep_parts_and_connections.EnableWindow( 1 );
m_radio_keep_fp.EnableWindow( 1 );
m_radio_change_fp.EnableWindow( 1 );
if( m_flags & KEEP_PARTS_AND_CON )
m_radio_keep_parts_and_connections.SetCheck( TRUE );
else if( m_flags & KEEP_PARTS_NO_CON )
m_radio_keep_parts_no_connections.SetCheck( TRUE );
else
m_radio_remove_parts.SetCheck( TRUE );
if( m_flags & KEEP_FP )
m_radio_keep_fp.SetCheck( TRUE );
else
m_radio_change_fp.SetCheck( TRUE );
}
else
{
m_radio_remove_parts.EnableWindow( 0 );
m_radio_keep_parts_no_connections.EnableWindow( 0 );
m_radio_keep_parts_and_connections.EnableWindow( 0 );
m_radio_keep_fp.EnableWindow( 0 );
m_radio_change_fp.EnableWindow( 0 );
}
if( m_flags & IMPORT_NETS )
{
m_radio_keep_nets.EnableWindow( 1 );
m_radio_remove_nets.EnableWindow( 1 );
m_check_keep_traces.EnableWindow( 1 );
m_check_keep_stubs.EnableWindow( 1 );
m_check_keep_areas.EnableWindow( 1 );
if( m_flags & KEEP_NETS )
m_radio_keep_nets.SetCheck( TRUE );
else
m_radio_remove_nets.SetCheck( TRUE );
m_check_keep_traces.SetCheck( m_flags & KEEP_TRACES );
m_check_keep_stubs.SetCheck( m_flags & KEEP_STUBS );
m_check_keep_areas.SetCheck( m_flags & KEEP_AREAS );
}
else
{
m_radio_keep_nets.EnableWindow( 0 );
m_radio_remove_nets.EnableWindow( 0 );
m_check_keep_traces.EnableWindow( 0 );
m_check_keep_stubs.EnableWindow( 0 );
m_check_keep_areas.EnableWindow( 0 );
}
}
else
{
// outgoing
if( m_flags & IMPORT_PARTS )
{
m_flags &= ~(KEEP_PARTS_NO_CON | KEEP_PARTS_AND_CON | KEEP_FP);
if( m_radio_keep_parts_no_connections.GetCheck() )
m_flags |= KEEP_PARTS_NO_CON;
else if( m_radio_keep_parts_and_connections.GetCheck() )
m_flags |= KEEP_PARTS_AND_CON;
if( m_radio_keep_fp.GetCheck() )
m_flags |= KEEP_FP;
}
if( m_flags & IMPORT_NETS )
{
m_flags &= ~(KEEP_NETS | KEEP_TRACES | KEEP_STUBS | KEEP_AREAS);
if( m_radio_keep_nets.GetCheck() )
m_flags |= KEEP_NETS;
if( m_check_keep_traces.GetCheck() )
m_flags |= KEEP_TRACES;
if( m_check_keep_stubs.GetCheck() )
m_flags |= KEEP_STUBS;
if( m_check_keep_areas.GetCheck() )
m_flags |= KEEP_AREAS;
}
}
}
BEGIN_MESSAGE_MAP(CDlgImportOptions, CDialog)
ON_BN_CLICKED(ID_SAVE_AND_IMPORT, OnBnClickedSaveAndImport)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()
void CDlgImportOptions::Initialize( int flags )
{
m_flags = flags;
}
// CDlgImportOptions message handlers
void CDlgImportOptions::OnBnClickedSaveAndImport()
{
m_flags |= SAVE_BEFORE_IMPORT;
OnOK();
}
void CDlgImportOptions::OnBnClickedOk()
{
m_flags &= ~SAVE_BEFORE_IMPORT;
OnOK();
}