forked from bigmacd/trapreceiver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExploderDestinations.cpp
More file actions
121 lines (96 loc) · 2.51 KB
/
Copy pathExploderDestinations.cpp
File metadata and controls
121 lines (96 loc) · 2.51 KB
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
#include "stdafx.h"
#include "traprcvr.h"
#include "ExploderDestinations.h"
#include "Registry.h"
ExploderDestinations::ExploderDestinations(CString list)
:CDialog(ExploderDestinations::IDD, NULL),
mInExploderList(list)
{
//{{AFX_DATA_INIT(ExploderDestinations)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void
ExploderDestinations::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ExploderDestinations)
DDX_Control(pDX, IDC_LIST1, mList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ExploderDestinations, CDialog)
//{{AFX_MSG_MAP(ExploderDestinations)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL
ExploderDestinations::OnInitDialog()
{
CDialog::OnInitDialog();
RECT rect;
mList.GetClientRect(&rect);
int width = (rect.right) - 5;
mList.InsertColumn(0, "Select", LVCFMT_LEFT, 60);
mList.InsertColumn(1, "Destination", LVCFMT_LEFT, width - 60);
mList.InsertColumn(2, "id", LVCFMT_LEFT, 0);
ListView_SetExtendedListViewStyle(mList.m_hWnd,
LVS_EX_CHECKBOXES);
// | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
Registry registry("Exploder");
int count = (int)registry.getCount();
try
{
for (int listLength = 0; listLength < count; listLength++)
{
LV_ITEM lv;
lv.mask = LVIF_TEXT;
registry.ReOpen(listLength);
lv.iItem = listLength;
lv.mask = LVIF_TEXT;
lv.iSubItem = 0;
lv.pszText = "";
mList.InsertItem(&lv);
CString data = registry.exploderDestination();
lv.mask = LVIF_TEXT;
lv.iSubItem = 1;
lv.pszText = data.GetBuffer(0);
mList.SetItem(&lv);
data.Format("%d", registry.exploderId());
CString exploderid = data.Right(6);
lv.mask = LVIF_TEXT;
lv.iSubItem = 2;
lv.pszText = exploderid.GetBuffer(0);
mList.SetItem(&lv);
if (mInExploderList.Find(exploderid) != -1)
mList.SetCheck(listLength);
}
}
catch(...)
{
}
return TRUE;
}
void
ExploderDestinations::OnOK()
{
// find all the checked items and put them into a comma separated list
mOutExploderList.Empty();
BOOL itemInList = FALSE;
int count = mList.GetItemCount();
for (int x = 0; x < count; x++)
{
if (mList.GetCheck(x))
{
if (itemInList)
mOutExploderList += ',';
itemInList = TRUE;
CString id = mList.GetItemText(x, 2);
mOutExploderList += id;
}
}
CDialog::OnOK();
}
CString
ExploderDestinations::ExploderList()
{
return mOutExploderList;
}