diff --git a/tools/apps/hgjson/DlgOptJson.cpp b/tools/apps/hgjson/DlgOptJson.cpp index 7ae1017..0c5b180 100644 --- a/tools/apps/hgjson/DlgOptJson.cpp +++ b/tools/apps/hgjson/DlgOptJson.cpp @@ -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,7 +864,8 @@ 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); GetDlgItem(IDC_EDIT_LOW)->EnableWindow(FALSE); diff --git a/tools/apps/hgjson/DlgOptJson.h b/tools/apps/hgjson/DlgOptJson.h index edb31a3..2c4c65a 100644 --- a/tools/apps/hgjson/DlgOptJson.h +++ b/tools/apps/hgjson/DlgOptJson.h @@ -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) { diff --git a/tools/apps/hgjson/hgjson.rc b/tools/apps/hgjson/hgjson.rc index 40c7dfe..f11dd15 100644 Binary files a/tools/apps/hgjson/hgjson.rc and b/tools/apps/hgjson/hgjson.rc differ diff --git a/tools/apps/hgjson/resource.h b/tools/apps/hgjson/resource.h index cc00c5d..a07744a 100644 Binary files a/tools/apps/hgjson/resource.h and b/tools/apps/hgjson/resource.h differ diff --git a/tools/solution/Release/hgjson.exe b/tools/solution/Release/hgjson.exe index 467686e..d4d6561 100644 Binary files a/tools/solution/Release/hgjson.exe and b/tools/solution/Release/hgjson.exe differ