调整json内容显示不全,增加json描述字段内容
This commit is contained in:
parent
2ed003307b
commit
d326b6a3be
|
@ -1,4 +1,4 @@
|
||||||
// CDlgInput.cpp: 实现文件
|
// CDlgInput.cpp: 实现文件
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
@ -29,6 +29,7 @@ void CDlgInput::DoDataExchange(CDataExchange* pDX)
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CDlgInput, CDialogEx)
|
BEGIN_MESSAGE_MAP(CDlgInput, CDialogEx)
|
||||||
ON_BN_CLICKED(IDOK, &CDlgInput::OnBnClickedOk)
|
ON_BN_CLICKED(IDOK, &CDlgInput::OnBnClickedOk)
|
||||||
|
ON_EN_CHANGE(IDC_EDIT1, &CDlgInput::OnEnChangeEdit1)
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +39,15 @@ BOOL CDlgInput::OnInitDialog()
|
||||||
CDialogEx::OnInitDialog();
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
::SetWindowTextW(m_hWnd, title_.c_str());
|
::SetWindowTextW(m_hWnd, title_.c_str());
|
||||||
|
|
||||||
|
size_t pos = val_.find(L"\\n");
|
||||||
|
while (pos != std::wstring::npos)
|
||||||
|
{
|
||||||
|
val_.replace(pos, 2, L"\r\n");
|
||||||
|
pos = val_.find(L"\\n");
|
||||||
|
}
|
||||||
|
while ((pos = val_.find(L"\\t")) != std::wstring::npos)
|
||||||
|
val_.replace(pos, 2, L"\t");
|
||||||
::SetDlgItemTextW(m_hWnd, IDC_EDIT1, val_.c_str());
|
::SetDlgItemTextW(m_hWnd, IDC_EDIT1, val_.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -46,10 +56,29 @@ BOOL CDlgInput::OnInitDialog()
|
||||||
void CDlgInput::OnBnClickedOk()
|
void CDlgInput::OnBnClickedOk()
|
||||||
{
|
{
|
||||||
// TODO: 在此添加控件通知处理程序代码
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
wchar_t val[128] = { 0 };
|
wchar_t val[1024] = { 0 };
|
||||||
|
|
||||||
::GetDlgItemTextW(m_hWnd, IDC_EDIT1, val, _countof(val) - 1);
|
::GetDlgItemTextW(m_hWnd, IDC_EDIT1, val, _countof(val) - 1);
|
||||||
val_ = val;
|
val_ = val;
|
||||||
|
|
||||||
|
size_t pos = val_.find(L"\r\n");
|
||||||
|
while (pos != std::wstring::npos)
|
||||||
|
{
|
||||||
|
val_.replace(pos, 2, L"\\n");
|
||||||
|
pos = val_.find(L"\r\n");
|
||||||
|
}
|
||||||
|
while ((pos = val_.find(L"\t")) != std::wstring::npos)
|
||||||
|
val_.replace(pos, 1, L"\\t");
|
||||||
CDialogEx::OnOK();
|
CDialogEx::OnOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDlgInput::OnEnChangeEdit1()
|
||||||
|
{
|
||||||
|
// TODO: 如果该控件是 RICHEDIT 控件,它将不
|
||||||
|
// 发送此通知,除非重写 CDialogEx::OnInitDialog()
|
||||||
|
// 函数并调用 CRichEditCtrl().SetEventMask(),
|
||||||
|
// 同时将 ENM_CHANGE 标志“或”运算到掩码中。
|
||||||
|
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
// CDlgInput 对话框
|
// CDlgInput 对话框
|
||||||
|
@ -31,4 +31,5 @@ public:
|
||||||
{
|
{
|
||||||
title_ = title ? title : L"\u4FEE\u6539";
|
title_ = title ? title : L"\u4FEE\u6539";
|
||||||
}
|
}
|
||||||
|
afx_msg void OnEnChangeEdit1();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// CDlgItemMgr.cpp: 实现文件
|
// CDlgItemMgr.cpp: 实现文件
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
@ -78,7 +78,7 @@ END_MESSAGE_MAP()
|
||||||
void CDlgItemMgr::OnBnClickedButtonAdd()
|
void CDlgItemMgr::OnBnClickedButtonAdd()
|
||||||
{
|
{
|
||||||
// TODO: 在此添加控件通知处理程序代码
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
wchar_t text[128] = { 0 }, name[128] = { 0 }, desc[128] = { 0 };
|
wchar_t text[1024] = { 0 }, name[1024] = { 0 }, desc[1024] = { 0 };
|
||||||
bool online = is_checked(this, IDC_CHECK_ONLINE), fatal = is_checked(this, IDC_CHECK_FATAL);
|
bool online = is_checked(this, IDC_CHECK_ONLINE), fatal = is_checked(this, IDC_CHECK_FATAL);
|
||||||
int ind = -1;
|
int ind = -1;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void CDlgItemMgr::OnBnClickedButtonAdd()
|
||||||
}
|
}
|
||||||
for (int i = 0; i < list_.GetItemCount(); ++i)
|
for (int i = 0; i < list_.GetItemCount(); ++i)
|
||||||
{
|
{
|
||||||
wchar_t val[128] = { 0 };
|
wchar_t val[1024] = { 0 };
|
||||||
list_.GetItemText(i, 1, val, _countof(val) - 1);
|
list_.GetItemText(i, 1, val, _countof(val) - 1);
|
||||||
if (wcscmp(name, val) == 0)
|
if (wcscmp(name, val) == 0)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ void CDlgItemMgr::OnNMDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
{
|
{
|
||||||
if (pos.x <= width[i])
|
if (pos.x <= width[i])
|
||||||
{
|
{
|
||||||
wchar_t text[128] = { 0 };
|
wchar_t text[1024] = { 0 };
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
std::wstring tips(L"\u5220\u9664\u6D4B\u8BD5\u9879\uFF1A");
|
std::wstring tips(L"\u5220\u9664\u6D4B\u8BD5\u9879\uFF1A");
|
||||||
|
@ -170,7 +170,7 @@ void CDlgItemMgr::OnNMDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CDlgInput input;
|
CDlgInput input;
|
||||||
wchar_t val[128] = { 0 };
|
wchar_t val[1024] = { 0 };
|
||||||
std::wstring def(L"");
|
std::wstring def(L"");
|
||||||
|
|
||||||
list_.GetItemText(ind, 2, val, _countof(val) - 1);
|
list_.GetItemText(ind, 2, val, _countof(val) - 1);
|
||||||
|
@ -215,22 +215,24 @@ std::wstring CDlgItemMgr::get_stored_config_file(void)
|
||||||
}
|
}
|
||||||
void CDlgItemMgr::get_item(int ind, page_config::ITEM* item)
|
void CDlgItemMgr::get_item(int ind, page_config::ITEM* item)
|
||||||
{
|
{
|
||||||
wchar_t text[128] = { 0 };
|
size_t len = 1024;
|
||||||
|
wchar_t *text = (wchar_t*)malloc(len + 1);
|
||||||
|
|
||||||
list_.GetItemText(ind, 1, text, _countof(text) - 1);
|
list_.GetItemText(ind, 1, text, len);
|
||||||
item->name = text;
|
item->name = text;
|
||||||
list_.GetItemText(ind, 2, text, _countof(text) - 1);
|
list_.GetItemText(ind, 2, text, len);
|
||||||
item->title = text;
|
item->title = text;
|
||||||
list_.GetItemText(ind, 3, text, _countof(text) - 1);
|
list_.GetItemText(ind, 3, text, len);
|
||||||
item->man = wcscmp(text, L"false") == 0;
|
item->man = wcscmp(text, L"false") == 0;
|
||||||
list_.GetItemText(ind, 4, text, _countof(text) - 1);
|
list_.GetItemText(ind, 4, text, len);
|
||||||
item->fatal = wcscmp(text, L"true") == 0;
|
item->fatal = wcscmp(text, L"true") == 0;
|
||||||
list_.GetItemText(ind, 5, text, _countof(text) - 1);
|
list_.GetItemText(ind, 5, text, len);
|
||||||
item->desc = text;
|
item->desc = text;
|
||||||
|
free(text);
|
||||||
}
|
}
|
||||||
void CDlgItemMgr::load_from_file(const wchar_t* file)
|
void CDlgItemMgr::load_from_file(const wchar_t* file)
|
||||||
{
|
{
|
||||||
wchar_t path[MAX_PATH] = { 0 },
|
wchar_t *path = (wchar_t*)malloc(MAX_PATH * 4),
|
||||||
*sn = path,
|
*sn = path,
|
||||||
*n = sn + 40,
|
*n = sn + 40,
|
||||||
*t = n + 40,
|
*t = n + 40,
|
||||||
|
@ -272,6 +274,7 @@ void CDlgItemMgr::load_from_file(const wchar_t* file)
|
||||||
cont.erase(0, pos + 2);
|
cont.erase(0, pos + 2);
|
||||||
}
|
}
|
||||||
::PostMessage(GetParent()->m_hWnd, WM_TEST_ITEM_CHANGED, 0, 0);
|
::PostMessage(GetParent()->m_hWnd, WM_TEST_ITEM_CHANGED, 0, 0);
|
||||||
|
free(path);
|
||||||
}
|
}
|
||||||
void CDlgItemMgr::load_stored_config(void)
|
void CDlgItemMgr::load_stored_config(void)
|
||||||
{
|
{
|
||||||
|
@ -299,7 +302,7 @@ void CDlgItemMgr::item_changed(void)
|
||||||
}
|
}
|
||||||
bool CDlgItemMgr::get_name(const wchar_t* title, page_config::ITEM* item)
|
bool CDlgItemMgr::get_name(const wchar_t* title, page_config::ITEM* item)
|
||||||
{
|
{
|
||||||
wchar_t text[128] = { 0 };
|
wchar_t text[1024] = { 0 };
|
||||||
|
|
||||||
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -316,7 +319,7 @@ bool CDlgItemMgr::get_name(const wchar_t* title, page_config::ITEM* item)
|
||||||
}
|
}
|
||||||
bool CDlgItemMgr::get_title(const wchar_t* name, page_config::ITEM* item)
|
bool CDlgItemMgr::get_title(const wchar_t* name, page_config::ITEM* item)
|
||||||
{
|
{
|
||||||
wchar_t text[128] = { 0 };
|
wchar_t text[1024] = { 0 };
|
||||||
|
|
||||||
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +336,7 @@ bool CDlgItemMgr::get_title(const wchar_t* name, page_config::ITEM* item)
|
||||||
}
|
}
|
||||||
void CDlgItemMgr::get_all_items(std::vector<page_config::ITEM>& items)
|
void CDlgItemMgr::get_all_items(std::vector<page_config::ITEM>& items)
|
||||||
{
|
{
|
||||||
wchar_t text[128] = { 0 };
|
wchar_t text[1024] = { 0 };
|
||||||
|
|
||||||
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
for (size_t i = 0; i < list_.GetItemCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue