code_production/cfg-tools/apps/scanner-check/CDlgItemMgr.cpp

616 lines
16 KiB
C++
Raw Normal View History

// CDlgItemMgr.cpp: 实现文件
2022-12-09 07:31:09 +00:00
//
#include "pch.h"
#include "scanner-check.h"
#include "CDlgItemMgr.h"
#include "afxdialogex.h"
#include "CDlgInput.h"
2022-12-09 07:31:09 +00:00
#include <file/file_util.h>
#include <coding/coding.h>
// CDlgItemMgr 对话框
#pragma warning(disable: 4996)
static bool is_checked(CWnd* ctrl)
{
return ((CButton*)ctrl)->GetCheck() == BST_CHECKED;
}
static bool is_checked(CDialogEx* dlg, UINT id)
{
return is_checked(dlg->GetDlgItem(id));
}
static void set_checked(CWnd* ctrl, bool checked)
{
((CButton*)ctrl)->SetCheck(checked ? BST_CHECKED : BST_UNCHECKED);
}
static void set_checked(CDialogEx* dlg, UINT id, bool checked)
{
return set_checked(dlg->GetDlgItem(id), checked);
}
IMPLEMENT_DYNAMIC(CDlgItemMgr, CDialogEx)
CDlgItemMgr::CDlgItemMgr(CWnd* pParent /*=nullptr*/)
2023-01-04 10:23:36 +00:00
: CDialogEx(IDD_TEST_ITEM, pParent), test_tmpl_(NULL), lst_trigger_sel_change_(false)
2022-12-09 07:31:09 +00:00
{
}
CDlgItemMgr::~CDlgItemMgr()
{
2023-01-04 10:23:36 +00:00
if (test_tmpl_)
test_tmpl_->release();
2022-12-09 07:31:09 +00:00
}
void CDlgItemMgr::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, list_);
2023-01-04 10:23:36 +00:00
DDX_Control(pDX, IDC_LIST_VAL, lst_param_);
DDX_Control(pDX, IDC_COMBO_PARAM_NAME, combo_param_);
DDX_Control(pDX, IDC_COMBO_PARAM_VAL0, combo_param_val_);
2022-12-09 07:31:09 +00:00
}
BOOL CDlgItemMgr::OnInitDialog()
{
CDialogEx::OnInitDialog();
2023-01-04 10:23:36 +00:00
std::vector<LSTCOL> cols;
LSTCOL col;
col.align = 0;
col.title = L"\u5E8F\u53F7";
col.width = 40;
cols.push_back(col);
col.title = L"\uFF29\uFF24";
col.width = 80;
cols.push_back(col);
col.title = L"\u6807\u9898";
col.width = 80;
cols.push_back(col);
col.title = L"\u6D4B\u8BD5\u5DE5\u4F4D";
col.width = 60;
cols.push_back(col);
col.title = L"\u5458\u5DE5\u6743\u9650";
col.width = 60;
cols.push_back(col);
col.title = L"\u8054\u673A";
col.width = 40;
cols.push_back(col);
col.title = L"\u5931\u8D25\u5219\u505C\u6B62";
col.width = 80;
cols.push_back(col);
col.title = L"\u63CF\u8FF0";
col.width = 200;
cols.push_back(col);
init_list_ctrl(&list_, cols);
cols.clear();
col.title = L"\u53C2\u6570\u540D\u79F0";
col.width = 160;
cols.push_back(col);
col.title = L"\u53C2\u6570\u503C";
col.width = 200;
cols.push_back(col);
init_list_ctrl(&lst_param_, cols);
init_sane_cfg();
2022-12-09 07:31:09 +00:00
load_stored_config();
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
BEGIN_MESSAGE_MAP(CDlgItemMgr, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON_ADD, &CDlgItemMgr::OnBnClickedButtonAdd)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, &CDlgItemMgr::OnNMDblclkList1)
ON_WM_DROPFILES()
2023-01-04 10:23:36 +00:00
ON_BN_CLICKED(IDC_BUTTON_ADD2, &CDlgItemMgr::OnBnClickedButtonAdd2)
ON_CBN_SELCHANGE(IDC_COMBO_PARAM_NAME, &CDlgItemMgr::OnCbnSelchangeComboParamName)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_VAL, &CDlgItemMgr::OnLvnItemchangedListVal)
ON_NOTIFY(NM_CLICK, IDC_LIST1, &CDlgItemMgr::OnNMClickList1)
ON_BN_CLICKED(IDC_BUTTON_SAVE_TEMPLATE, &CDlgItemMgr::OnBnClickedButtonSaveTemplate)
ON_BN_CLICKED(IDC_BUTTON_CLEAR, &CDlgItemMgr::OnBnClickedButtonClear)
2022-12-09 07:31:09 +00:00
END_MESSAGE_MAP()
// CDlgItemMgr 消息处理程序
void CDlgItemMgr::OnBnClickedButtonAdd()
{
// TODO: 在此添加控件通知处理程序代码
2023-01-04 10:23:36 +00:00
wchar_t text[128] = { 0 };
2022-12-09 07:31:09 +00:00
int ind = -1;
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* jsn = NULL;
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
if (GetDlgItemTextW(IDC_EDIT_NAME, text, _countof(text) - 1) == 0)
{
::MessageBoxW(m_hWnd, L"\u5FC5\u987B\u8F93\u5165NAME\uFF01", L"Error", MB_OK | MB_ICONSTOP);
GotoDlgCtrl(GetDlgItem(IDC_EDIT_NAME));
2022-12-09 07:31:09 +00:00
return;
2023-01-04 10:23:36 +00:00
}
ind = find_test_item(text, &jsn);
if (ind == -1)
{
2023-01-04 10:23:36 +00:00
jsn = known_file_util::create_jsonW();
jsn->set_value(L"name", text);
ind = list_.InsertItem(list_.GetItemCount(), std::to_wstring(list_.GetItemCount() + 1).c_str());
list_.SetItemText(ind, 1, text);
list_.SetItemData(ind, (DWORD_PTR)jsn);
jsn->add_ref();
}
2023-01-04 10:23:36 +00:00
GetDlgItemTextW(IDC_EDIT_TITLE, text, _countof(text) - 1);
jsn->set_value(L"title", text);
list_.SetItemText(ind, 2, text);
GetDlgItemTextW(IDC_COMBO_STATION, text, _countof(text) - 1);
jsn->set_value(L"station", text);
list_.SetItemText(ind, 3, text);
GetDlgItemTextW(IDC_EDIT_PRIV, text, _countof(text) - 1);
jsn->set_value(L"authority", text);
list_.SetItemText(ind, 4, text);
bool bv = ((CButton*)GetDlgItem(IDC_CHECK_ONLINE))->GetCheck() == BST_CHECKED;
jsn->set_value(L"man", !bv);
list_.SetItemText(ind, 5, bv ? L"true" : L"false");
bv = ((CButton*)GetDlgItem(IDC_CHECK_FATAL))->GetCheck() == BST_CHECKED;
jsn->set_value(L"err-level", bv ? L"fatal" : L"ignore");
list_.SetItemText(ind, 6, bv ? L"true" : L"false");
std::wstring desc(get_window_text(GetDlgItem(IDC_EDIT_DESC)->m_hWnd));
replace(desc, L"\r", L"\\r");
replace(desc, L"\n", L"\\n");
jsn->set_value(L"desc", desc.c_str());
list_.SetItemText(ind, 7, desc.c_str());
// param ...
jsn->remove_value(L"param");
if (lst_param_.GetItemCount())
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* param = known_file_util::create_jsonW();
for (int i = 0; i < lst_param_.GetItemCount(); ++i)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* sane = (known_file_util::IJsonW*)lst_param_.GetItemData(i);
const wchar_t* type = NULL;
sane->get_value(L"type", &type);
desc = get_list_item_text(&lst_param_, i, 1);
if (wcscmp(type, L"bool") == 0)
{
param->set_value(sane->key(), desc == L"true");
}
else if (wcscmp(type, L"int") == 0)
{
param->set_value(sane->key(), _wtoi(desc.c_str()));
}
else if (wcscmp(type, L"float") == 0)
{
param->set_value(sane->key(), _wtof(desc.c_str()));
}
else // string
{
param->set_value(sane->key(), desc.c_str());
}
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
jsn->set_value(L"param", param);
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
test_tmpl_->set_value(jsn->key(), jsn);
jsn->release();
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
save_test_template(STORE_FILE_TEMP);
2022-12-09 07:31:09 +00:00
}
void CDlgItemMgr::OnNMDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
2023-01-04 10:23:36 +00:00
if (pNMItemActivate->iItem != -1)
{
known_file_util::IJsonW* jsn = (known_file_util::IJsonW*)list_.GetItemData(pNMItemActivate->iItem);
const wchar_t* val = NULL;
jsn->get_value(L"title", &val);
if (::MessageBoxW(m_hWnd, (std::wstring(L"\u60A8\u786E\u8BA4\u8981\u5220\u9664\u6D4B\u8BD5\u9879\u201C") + val + L"\u201D\u5417\uFF1F").c_str(), L"\u786E\u8BA4", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
test_tmpl_->remove_value(jsn->key());
jsn->release();
list_.DeleteItem(pNMItemActivate->iItem);
for (int i = pNMItemActivate->iItem; i < list_.GetItemCount(); ++i)
{
list_.SetItemText(i, 0, std::to_wstring(i + 1).c_str());
}
save_test_template(STORE_FILE_TEMP);
}
}
*pResult = 0;
}
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
void CDlgItemMgr::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
if (pNMItemActivate->iItem != -1)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* jsn = (known_file_util::IJsonW*)list_.GetItemData(pNMItemActivate->iItem), * param = NULL;
const wchar_t* sv = NULL;
std::wstring str(L"");
bool bv = true;
int nv = 0;
double dv = .0f;
jsn->get_value(L"name", &sv);
::SetDlgItemTextW(m_hWnd, IDC_EDIT_NAME, sv);
sv = NULL;
jsn->get_value(L"title", &sv);
::SetDlgItemTextW(m_hWnd, IDC_EDIT_TITLE, sv);
jsn->get_value(L"man", bv);
((CButton*)GetDlgItem(IDC_CHECK_ONLINE))->SetCheck(bv ? BST_UNCHECKED : BST_CHECKED);
sv = NULL;
jsn->get_value(L"station", &sv);
::SetDlgItemTextW(m_hWnd, IDC_COMBO_STATION, sv);
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
jsn->get_value(L"authority", nv);
SetDlgItemInt(IDC_EDIT_PRIV, nv);
jsn->get_value(L"err-level", &sv);
((CButton*)GetDlgItem(IDC_CHECK_FATAL))->SetCheck(wcscmp(sv, L"fatal") ? BST_UNCHECKED : BST_CHECKED);
if (jsn->get_value(L"desc", &sv) && sv)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
str = sv;
replace(str, L"\\r", L"\r");
replace(str, L"\\n", L"\n");
::SetDlgItemTextW(m_hWnd, IDC_EDIT_DESC, str.c_str());
str.clear();
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
jsn->get_value(L"param", &param);
lst_param_.DeleteAllItems();
if (param)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::JSONMEMW jm = param->first_member();
while (jm.type != known_file_util::JV_UNKNOWN)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* sane = NULL;
nv = find_sane_item(jm.key, &sane);
if (sane)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
sane->get_value(L"title", &sv);
nv = lst_param_.InsertItem(lst_param_.GetItemCount(), sv);
sane->get_value(L"type", &sv);
if (wcscmp(sv, L"bool") == 0)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
lst_param_.SetItemText(nv, 1, jm.bool_val ? L"true" : L"false");
}
else if (wcscmp(sv, L"int") == 0)
{
lst_param_.SetItemText(nv, 1, std::to_wstring(jm.int_val).c_str());
}
else if (wcscmp(sv, L"float") == 0)
{
lst_param_.SetItemText(nv, 1, std::to_wstring(jm.double_val).c_str());
2022-12-09 07:31:09 +00:00
}
else
{
2023-01-04 10:23:36 +00:00
lst_param_.SetItemText(nv, 1, jm.str_val);
}
2023-01-04 10:23:36 +00:00
sane->release();
}
2023-01-04 10:23:36 +00:00
jm = param->next_member();
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
param->release();
2022-12-09 07:31:09 +00:00
}
}
*pResult = 0;
}
2023-01-04 10:23:36 +00:00
std::wstring CDlgItemMgr::get_stored_config_file(int type)
2022-12-09 07:31:09 +00:00
{
wchar_t path[MAX_PATH] = { 0 };
std::wstring file(L"");
size_t pos = 0;
GetModuleFileNameW(NULL, path, _countof(path) - 1);
file = path;
pos = file.rfind(L'\\');
if (pos++ != std::wstring::npos)
file.erase(pos);
2023-01-04 10:23:36 +00:00
if(type == STORE_FILE_BACKUP)
file += L"config\\stored_bkp.txt";
else if(type == STORE_FILE_TEMP)
file += L"config\\stored_tmp.txt";
else
file += L"config\\stored.txt";
2022-12-09 07:31:09 +00:00
return file;
}
void CDlgItemMgr::load_from_file(const wchar_t* file)
{
2023-01-04 10:23:36 +00:00
int size = 2048, cnt = 0;
wchar_t *path = (wchar_t*)malloc(size),
2022-12-09 07:31:09 +00:00
*sn = path,
*n = sn + 40,
*t = n + 40,
*m = t + 40,
*f = m + 40,
*d = f + 40;
2022-12-09 07:31:09 +00:00
size_t pos = 0;
std::string bom("");
std::wstring cont(L"");
list_.DeleteAllItems();
file_util::load_file(file, got_str, &bom);
coding_util::bom::to_unicode(bom.c_str(), bom.length(), got_wstr, &cont);
2023-01-04 10:23:36 +00:00
bom.clear();
if (test_tmpl_)
test_tmpl_->release();
test_tmpl_ = known_file_util::create_jsonW();
if (!test_tmpl_->attach(cont.c_str()))
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
test_tmpl_->clear();
cont += L"\r\n";
while ((pos = cont.find(L"\r\n")) != std::wstring::npos)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
int num = swscanf(cont.substr(0, pos).c_str(), L"%s %s %s %s %s", n, t, m, f, d);
if (num >= 2)
{
known_file_util::IJsonW* child = known_file_util::create_jsonW();
child->set_value(L"name", n);
child->set_value(L"title", t);
if (!m)
m = L"false";
child->set_value(L"man", wcscmp(m, L"true") != 0);
if (!f)
f = L"true";
child->set_value(L"err-level", wcscmp(f, L"true") ? L"ignore" : L"fatal");
if (!d)
d = L"";
child->set_value(L"desc", d);
test_tmpl_->set_value(n, child);
child->release();
}
memset(path, 0, size);
cont.erase(0, pos + 2);
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
cont.clear();
test_tmpl_->to_string(got_wstr, &cont);
file_util::force_move_file(file, (std::wstring(file) + L".bkp").c_str());
coding_util::bom::from_unicode(cont.c_str(), cont.length() * 2, got_str, &bom);
file_util::save_2_file(bom.c_str(), bom.length(), file);
bom.clear();
cont.clear();
}
cnt = 1;
known_file_util::IJsonW* child = test_tmpl_->first_child();
while (child)
{
const wchar_t* sv = NULL;
bool bv = true;
int nv = 0;
int ind = list_.InsertItem(list_.GetItemCount(), std::to_wstring(list_.GetItemCount() + 1).c_str());
child->get_value(L"name", &sv);
list_.SetItemText(ind, 1, sv);
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
if(child->get_value(L"title", &sv))
list_.SetItemText(ind, 2, sv);
if(child->get_value(L"station", &sv))
list_.SetItemText(ind, 3, sv);
if(child->get_value(L"authority", nv))
list_.SetItemText(ind, 4, std::to_wstring(nv).c_str());
if(child->get_value(L"man", bv))
list_.SetItemText(ind, 5, bv ? L"false" : L"true");
if(child->get_value(L"err-level", &sv))
list_.SetItemText(ind, 6, wcscmp(sv, L"fatal") == 0 ? L"true" : L"false");
child->get_value(L"desc", &sv);
list_.SetItemText(ind, 7, sv);
list_.SetItemData(ind, (DWORD_PTR)child);
child = test_tmpl_->next_child();
2022-12-09 07:31:09 +00:00
}
::PostMessage(GetParent()->m_hWnd, WM_TEST_ITEM_CHANGED, 0, 0);
free(path);
2022-12-09 07:31:09 +00:00
}
void CDlgItemMgr::load_stored_config(void)
{
std::wstring file(get_stored_config_file());
load_from_file(file.c_str());
}
2023-01-04 10:23:36 +00:00
void CDlgItemMgr::init_sane_cfg(void)
2022-12-09 07:31:09 +00:00
{
std::wstring text(L"");
2023-01-04 10:23:36 +00:00
const wchar_t *val = NULL;
int ind = -1;
known_file_util::IJsonW* jsn = NULL, * child = NULL;
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
for (int i = 0; i < combo_param_.GetCount(); ++i)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
((known_file_util::IJsonW*)combo_param_.GetItemData(i))->release();
}
combo_param_.ResetContent();
get_sane_config(text);
jsn = known_file_util::create_jsonW(text.c_str());
if (jsn)
{
child = jsn->first_child();
if (child)
{
child->release();
while ((child = jsn->next_child()))
{
child->get_value(L"type", &val);
if (wcscmp(val, L"button") && wcscmp(val, L"group"))
{
child->get_value(L"title", &val);
while (*val == L' ' || *val == L'\t')
val++;
ind = combo_param_.AddString(val);
combo_param_.SetItemData(ind, (DWORD_PTR)child);
}
}
}
jsn->release();
2022-12-09 07:31:09 +00:00
}
}
2023-01-04 10:23:36 +00:00
int CDlgItemMgr::find_test_item(const wchar_t* name, known_file_util::IJsonW** jsn)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
for (int i = 0; i < list_.GetItemCount(); ++i)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* js = (known_file_util::IJsonW*)list_.GetItemData(i);
const wchar_t* val = 0;
js->get_value(L"name", &val);
if (wcscmp(val, name) == 0)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
if (jsn)
{
*jsn = js;
js->add_ref();
}
return i;
2022-12-09 07:31:09 +00:00
}
}
2023-01-04 10:23:36 +00:00
return -1;
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
int CDlgItemMgr::find_sane_item(const wchar_t* name, known_file_util::IJsonW** jsn)
2022-12-09 08:56:15 +00:00
{
2023-01-04 10:23:36 +00:00
for (int i = 0; i < combo_param_.GetCount(); ++i)
2022-12-09 08:56:15 +00:00
{
2023-01-04 10:23:36 +00:00
known_file_util::IJsonW* js = (known_file_util::IJsonW*)combo_param_.GetItemData(i);
if (wcscmp(js->key(), name) == 0)
2022-12-09 08:56:15 +00:00
{
2023-01-04 10:23:36 +00:00
if (jsn)
{
*jsn = js;
js->add_ref();
}
return i;
2022-12-09 08:56:15 +00:00
}
}
2023-01-04 10:23:36 +00:00
return -1;
2022-12-09 08:56:15 +00:00
}
2023-01-04 10:23:36 +00:00
void CDlgItemMgr::save_test_template(int type)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
if (test_tmpl_)
{
std::wstring cont(L""), file(get_stored_config_file(type));
std::string bom("");
test_tmpl_->to_string(got_wstr, &cont);
coding_util::bom::from_unicode(cont.c_str(), cont.length() * 2, got_str, &bom);
cont.clear();
file_util::save_2_file(bom.c_str(), bom.length(), file.c_str());
}
}
known_file_util::IJsonW* CDlgItemMgr::get_all_items(void)
{
if (test_tmpl_)
2022-12-09 07:31:09 +00:00
{
2023-01-04 10:23:36 +00:00
std::wstring text(L"");
test_tmpl_->to_string(got_wstr, &text);
known_file_util::IJsonW* jsn = known_file_util::create_jsonW(text.c_str());
return jsn;
2022-12-09 07:31:09 +00:00
}
2023-01-04 10:23:36 +00:00
return NULL;
2022-12-09 07:31:09 +00:00
}
void CDlgItemMgr::OnDropFiles(HDROP hDropInfo)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
// TODO: 在此添加消息处理程序代码和/或调用默认值
wchar_t path[MAX_PATH] = { 0 };
std::wstring cont(L"");
std::string bom("");
DragQueryFileW(hDropInfo, 0, path, _countof(path) - 1);
load_from_file(path);
CDialogEx::OnDropFiles(hDropInfo);
}
2022-12-09 08:56:15 +00:00
2023-01-04 10:23:36 +00:00
void CDlgItemMgr::OnBnClickedButtonAdd2()
{
// TODO: 在此添加控件通知处理程序代码 添加测试参数
add_param(m_hWnd, &combo_param_, &combo_param_val_, &lst_param_, IDC_EDIT_PARAM_VAL1);
}
void CDlgItemMgr::OnCbnSelchangeComboParamName()
{
// TODO: 在此添加控件通知处理程序代码
on_combo_param_changed(m_hWnd, &combo_param_, &combo_param_val_, &lst_param_, IDC_EDIT_PARAM_VAL1, lst_trigger_sel_change_);
}
void CDlgItemMgr::notify_combo_param_changed(void* param)
{
struct _cb_chg
{
CDlgItemMgr* dlg;
void(CDlgItemMgr::* cb_sel_change)(void);
};
struct _cb_chg* chg = (struct _cb_chg*)param;
chg->dlg->lst_trigger_sel_change_ = true;
(chg->dlg->*chg->cb_sel_change)();
chg->dlg->lst_trigger_sel_change_ = false;
}
void CDlgItemMgr::OnLvnItemchangedListVal(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
struct _cb_chg
{
CDlgItemMgr* dlg;
void(CDlgItemMgr::* cb_sel_change)(void);
}param = { this, &CDlgItemMgr::OnCbnSelchangeComboParamName };
on_list_param_sel_changed(&combo_param_, &lst_param_, pNMLV->iItem, &CDlgItemMgr::notify_combo_param_changed, &param);
*pResult = 0;
}
void CDlgItemMgr::OnBnClickedButtonSaveTemplate()
{
// TODO: 在此添加控件通知处理程序代码
save_test_template(STORE_FILE_SELF);
file_util::force_delete_file(get_stored_config_file(STORE_FILE_TEMP).c_str());
}
void CDlgItemMgr::OnBnClickedButtonClear()
{
// TODO: 在此添加控件通知处理程序代码
lst_param_.DeleteAllItems();
}