部分选项特殊处理

This commit is contained in:
mo1027728827@qq.com 2022-06-28 17:28:51 +08:00
parent 17454877a8
commit a9f1e5a8dc
5 changed files with 50 additions and 41 deletions

View File

@ -20,13 +20,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -20,7 +20,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>

View File

@ -5881,7 +5881,7 @@ BOOL ChgjsonDlg::OnInitDialog()
constraint_list_.InsertColumn(1, TEXT("Default"), 0, 48);
type_.SetCurSel(0);
constraint_.SetCurSel(0);
// constraint_list_.ModifyStyleEx(0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
// constraint_list_.ModifyStyleEx(0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
constraint_list_.SetExtendedStyle(constraint_list_.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
constraint_list_.SetItemData(constraint_list_.InsertItem(constraint_list_.GetItemCount(), TEXT("click me to add value ...")), 1);
tree_menu_.LoadMenu(IDR_MENU1);
@ -5955,7 +5955,7 @@ std::string ChgjsonDlg::save_define_header_2_file(std::vector<DEFH>& defs, const
prev(L"none");
wchar_t buf[128] = { 0 };
time_t t = time(NULL);
struct tm *now = localtime(&t);
struct tm* now = localtime(&t);
swprintf(buf, L"// Date: %04d-%02d-%02d %02d:%02d:%02d\r\n//\r\n", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday
, now->tm_hour, now->tm_min, now->tm_sec);
@ -6267,11 +6267,20 @@ void* ChgjsonDlg::create_json(int item, std::vector<DEFH>* def_h)
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_CUSTOM_AREA_RIGHT).c_str());
else if (hg_items_[item].title == L"\u626B\u63CF\u533A\u57DF\u4E0B\u4FA7\uFF08mm\uFF09")
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_CUSTOM_AREA_BOTTOM).c_str());
else if (hg_items_[item].title == L"ÑÕɫģʽ")
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_COLOR_MODE).c_str());
else if (hg_items_[item].title == L"Ö½Õųߴç")
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_PAPER).c_str());
else if (hg_items_[item].title == L"ɨÃèÒ³Ãæ")
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_PAGE_TYPE).c_str());
else if (hg_items_[item].title == L"³¬Éù²¨¼ì²â")
jsn->set_value(L"name", coding::a2u(SANE_STD_OPT_NAME_ULTRASONIC_CHECK).c_str());
else
{
swprintf_s(buf, _countof(buf) - 1, L"cfg-%d", hg_items_[item].index);
jsn->set_value(L"name", buf);
}
jsn->set_value(L"title", hg_items_[item].title.c_str());
if (def_h)
ChgjsonDlg::to_define_header(*def_h, hg_items_[item].title.c_str());
@ -6301,7 +6310,7 @@ void* ChgjsonDlg::create_json(int item, std::vector<DEFH>* def_h)
if (hg_items_[item].range.type == RANGE_TYPE_RANGE)
{
known_file_util::IJsonW *r = known_file_util::create_jsonW();
known_file_util::IJsonW* r = known_file_util::create_jsonW();
if (hg_items_[item].type == L"int")
{
r->set_value(L"min", (int)hg_items_[item].range.lower);
@ -6317,7 +6326,7 @@ void* ChgjsonDlg::create_json(int item, std::vector<DEFH>* def_h)
}
else if (hg_items_[item].range.type == RANGE_TYPE_LIST)
{
known_file_util::IJsonW *r = known_file_util::create_jsonW();
known_file_util::IJsonW* r = known_file_util::create_jsonW();
r->set_as_array(true);
if (hg_items_[item].type == L"int")
{
@ -6353,7 +6362,7 @@ void* ChgjsonDlg::create_json(int item, std::vector<DEFH>* def_h)
if (hg_items_[item].depend.size())
{
known_file_util::IJsonW *d = known_file_util::create_jsonW();
known_file_util::IJsonW* d = known_file_util::create_jsonW();
d->set_as_array(true);
for (int i = 0; i < hg_items_[item].depend.size(); ++i)
{
@ -6372,14 +6381,14 @@ void* ChgjsonDlg::create_json(int item, std::vector<DEFH>* def_h)
jsn->set_value(L"depend_and", d);
d->release();
}
if(prefer_size)
if (prefer_size)
jsn->set_value(L"size", prefer_size);
return jsn;
}
std::string ChgjsonDlg::to_json_text(bool for_const)
{
known_file_util::IJsonW *jsn = known_file_util::create_jsonW(), *item = NULL;
known_file_util::IJsonW* jsn = known_file_util::create_jsonW(), * item = NULL;
HTREEITEM root = tree_.GetRootItem(), child = NULL;
std::wstring val(get_tree_selected_item_text(&tree_, root));
int count = 1, group = 1, ind = 0;
@ -6481,9 +6490,9 @@ std::string ChgjsonDlg::to_json_text(bool for_const)
}
void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent)
{
known_file_util::IJsonW *jsn = (known_file_util::IJsonW*)jsn_obj, *child = NULL,
*root = (known_file_util::IJsonW*)jsn_root;
const wchar_t *val = NULL;
known_file_util::IJsonW* jsn = (known_file_util::IJsonW*)jsn_obj, * child = NULL,
* root = (known_file_util::IJsonW*)jsn_root;
const wchar_t* val = NULL;
HGITEM item;
wchar_t buf[128] = { 0 };
@ -6556,7 +6565,7 @@ void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent)
if (split(m.str_val, &di))
{
known_file_util::IJsonW *d = NULL;
known_file_util::IJsonW* d = NULL;
root->get_value(di.parent.c_str(), &d);
if (d)
{
@ -6574,7 +6583,7 @@ void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent)
m = child->next_member();
if (split(m.str_val, &di))
{
known_file_util::IJsonW *d = NULL;
known_file_util::IJsonW* d = NULL;
root->get_value(di.parent.c_str(), &d);
if (d)
{
@ -6672,7 +6681,7 @@ void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent)
bool ChgjsonDlg::load_from_json_text(const wchar_t* txt)
{
int pos = 0;
known_file_util::IJsonW *jsn = known_file_util::create_jsonW(txt, &pos), *child = NULL;
known_file_util::IJsonW* jsn = known_file_util::create_jsonW(txt, &pos), * child = NULL;
if (!jsn)
return false;
@ -7133,9 +7142,9 @@ void ChgjsonDlg::OnCbnSelchangeLogic()
}
void ChgjsonDlg::OnLvnEndlabeleditListValues(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnLvnEndlabeleditListValues(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
// TODO: Add your control notification handler code here
*pResult = 0;
DWORD_PTR data = constraint_list_.GetItemData(pDispInfo->item.iItem);
@ -7285,8 +7294,8 @@ void ChgjsonDlg::OnBnClickedButton3()
}
it->depend.push_back(di);
it->depend_or = or;
// if (depends_.FindString(-1, (di.parent + di.logic_values).c_str()) == -1)
it->depend_or = or ;
// if (depends_.FindString(-1, (di.parent + di.logic_values).c_str()) == -1)
depends_.AddString((di.parent + di.logic_values).c_str());
}
void ChgjsonDlg::OnBnClickedButton4()
@ -7391,7 +7400,7 @@ void ChgjsonDlg::OnBnClickedButton4()
}
void ChgjsonDlg::OnNMRClickMfcshelltree1(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnNMRClickMfcshelltree1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
@ -7426,7 +7435,7 @@ void ChgjsonDlg::OnNMRClickMfcshelltree1(NMHDR *pNMHDR, LRESULT *pResult)
}
void ChgjsonDlg::OnTvnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnTvnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7474,7 +7483,7 @@ void ChgjsonDlg::OnListmenuDelete()
}
void ChgjsonDlg::OnNMRClickListValues(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnNMRClickListValues(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7533,7 +7542,7 @@ void ChgjsonDlg::OnTreeLoadfile()
}
void ChgjsonDlg::OnLvnKeydownListValues(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnLvnKeydownListValues(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7574,7 +7583,7 @@ void ChgjsonDlg::OnLvnKeydownListValues(NMHDR *pNMHDR, LRESULT *pResult)
}
void ChgjsonDlg::OnTvnKeydownTree1(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnTvnKeydownTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTVKEYDOWN pTVKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7666,7 +7675,7 @@ void ChgjsonDlg::OnTvnKeydownTree1(NMHDR *pNMHDR, LRESULT *pResult)
}
void ChgjsonDlg::OnTvnGetInfoTipTree1(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnTvnGetInfoTipTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMTVGETINFOTIP>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7677,7 +7686,7 @@ void ChgjsonDlg::OnTvnGetInfoTipTree1(NMHDR *pNMHDR, LRESULT *pResult)
}
void ChgjsonDlg::OnLvnGetInfoTipListValues(NMHDR *pNMHDR, LRESULT *pResult)
void ChgjsonDlg::OnLvnGetInfoTipListValues(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMLVGETINFOTIP>(pNMHDR);
// TODO: Add your control notification handler code here
@ -7706,7 +7715,7 @@ void ChgjsonDlg::OnTreeExportCharConstants()
{
// TODO: 在此添加命令处理程序代码
std::string bom(to_json_text(true));
if(bom.empty())
if (bom.empty())
MessageBox(TEXT("No char constant"));
else
MessageBox(TEXT("const string has set to clipboard already"));

Binary file not shown.

Binary file not shown.