fix bug
This commit is contained in:
parent
9dd97b57a0
commit
5e66a20a79
|
@ -435,11 +435,32 @@ void CDlgOptJson::from_ui(SANEOPT& sop)
|
|||
val = get_item_text(IDC_EDIT_DEFAULT);
|
||||
else
|
||||
val = get_item_text(IDC_COMBO_DEFAULT);
|
||||
sop.def_val = std::string((const char*)val.c_str(), val.length() * 2 + 2);
|
||||
if (sop.type == L"bool")
|
||||
{
|
||||
bool v = val == L"true";
|
||||
sop.def_val = std::string((char*)&v, sizeof(v));
|
||||
}
|
||||
else if (sop.type == L"int")
|
||||
{
|
||||
int v = _wtoi(val.c_str());
|
||||
sop.def_val = std::string((char*)&v, sizeof(v));
|
||||
}
|
||||
else if (sop.type == L"float")
|
||||
{
|
||||
double v = _wtof(val.c_str());
|
||||
sop.def_val = std::string((char*)&v, sizeof(v));
|
||||
}
|
||||
else if (sop.type == L"string")
|
||||
{
|
||||
sop.def_val = std::string((const char*)val.c_str(), val.length() * 2 + 2);
|
||||
}
|
||||
else
|
||||
sop.def_val = "";
|
||||
|
||||
sop.enable = is_button_check(IDC_CHECK_ENABLE);
|
||||
sop.range_type = get_item_text(IDC_COMBO_RANGE);
|
||||
sop.depend_oper = get_item_text(IDC_COMBO_DEPEND);
|
||||
sop.depends.clear();
|
||||
if (sop.depend_oper != L"none")
|
||||
{
|
||||
wchar_t buf[256] = { 0 };
|
||||
|
@ -1141,6 +1162,7 @@ void CDlgOptJson::OnBnClickedButtonModify()
|
|||
{
|
||||
if (::MessageBoxW(m_hWnd, (L"\u5DF2\u7ECF\u5B58\u5728\u540D\u4E3A\u201C" + v.title + L"\u201D\u7684\u914D\u7F6E\u9879\uFF01\uFF0C\u60F3\u4FEE\u6539Name\u5B57\u6BB5\u5417\uFF1F").c_str(), L"Error", MB_ICONSTOP | MB_YESNO) == IDYES)
|
||||
{
|
||||
sop.range = std::move(v.range);
|
||||
v = std::move(sop);
|
||||
}
|
||||
return;
|
||||
|
@ -1151,12 +1173,14 @@ void CDlgOptJson::OnBnClickedButtonModify()
|
|||
{
|
||||
if (v.name == sop.name)
|
||||
{
|
||||
sop.range = std::move(v.range);
|
||||
v = std::move(sop);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
opts_.push_back(sop);
|
||||
insert_to_tree(sop);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1386,17 +1410,22 @@ void CDlgOptJson::OnBnClickedButtonSet()
|
|||
{
|
||||
if (v.name == opt.name)
|
||||
{
|
||||
v = std::move(opt);
|
||||
from_ui(v);
|
||||
v.range = opt.range;
|
||||
v.def_val = opt.def_val;
|
||||
to_ui(v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> r(std::move(opt.range));
|
||||
SANEOPT so;
|
||||
|
||||
from_ui(opt);
|
||||
opt.range = std::move(r);
|
||||
from_ui(so);
|
||||
so.range = opt.range;
|
||||
so.def_val = opt.def_val;
|
||||
opts_.push_back(opt);
|
||||
insert_to_tree(opt);
|
||||
to_ui(opt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue