This commit is contained in:
yangjiaxuan 2023-08-23 18:42:49 +08:00
commit 56c83d9544
5 changed files with 10 additions and 1 deletions

View File

@ -108,6 +108,8 @@ known_file_util::IJsonW* CDlgOptJson::SANEOPT::to_json(void)
jsn->set_value(L"visible", open);
jsn->set_value(L"enabled", enable);
jsn->set_value(L"size", (int)sizeof(int));
if (!auto_restore_default)
jsn->set_value(L"auto", auto_restore_default);
if (type == L"bool")
{
@ -304,6 +306,8 @@ bool CDlgOptJson::SANEOPT::from_json(known_file_util::IJsonW* jsn)
jsn->get_value(L"visible", open);
jsn->get_value(L"enabled", enable);
jsn->get_value(L"fix-id", fix_id);
if (!jsn->get_value(L"auto", auto_restore_default))
auto_restore_default = true;
if (jsn->get_value(L"range", &child) && child)
{
@ -471,6 +475,7 @@ void CDlgOptJson::from_ui(SANEOPT& sop)
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.auto_restore_default = is_button_check(IDC_CHECK_AUTO_RESTORE);
sop.depends.clear();
if (sop.depend_oper != L"none")
{
@ -534,6 +539,7 @@ void CDlgOptJson::to_ui(const SANEOPT& sop)
set_button_check(IDC_CHECK_READONLY, sop.readonly);
set_button_check(IDC_CHECK_PUBLIC, sop.open);
set_button_check(IDC_CHECK_ENABLE, sop.enable);
set_button_check(IDC_CHECK_AUTO_RESTORE, sop.auto_restore_default);
n = range_.FindStringExact(-1, sop.range_type.c_str());
range_.SetCurSel(n);
@ -858,6 +864,7 @@ BOOL CDlgOptJson::OnInitDialog()
range_.SetCurSel(0);
def_val_.SetCurSel(0);
depend_.SetCurSel(0);
set_button_check(IDC_CHECK_AUTO_RESTORE, true);
parent_.EnableWindow(FALSE);
logic_.EnableWindow(FALSE);

View File

@ -88,6 +88,7 @@ public:
bool readonly;
bool open;
bool enable;
bool auto_restore_default;
struct _sane_opt_json()
{
@ -116,6 +117,7 @@ public:
opt->readonly = false;
opt->open = true;
opt->enable = true;
opt->auto_restore_default = true;
}
static void affect_str(int& val, std::wstring& str, bool to_str)
{

Binary file not shown.

Binary file not shown.

Binary file not shown.