diff --git a/tools/apps/hgjson/hgjson.rc b/tools/apps/hgjson/hgjson.rc index 3065141..880020c 100644 Binary files a/tools/apps/hgjson/hgjson.rc and b/tools/apps/hgjson/hgjson.rc differ diff --git a/tools/apps/hgjson/hgjsonDlg.cpp b/tools/apps/hgjson/hgjsonDlg.cpp index 1a5cf71..b1dc9f7 100644 --- a/tools/apps/hgjson/hgjsonDlg.cpp +++ b/tools/apps/hgjson/hgjsonDlg.cpp @@ -6301,6 +6301,8 @@ void ChgjsonDlg::set_control_status(const HGITEM& item) GetDlgItem(IDC_STATIC_DEFAULT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_DEFAULT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_COMBO_DEFAULT)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_EDIT_STEP)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_STATIC_STEP)->ShowWindow(SW_HIDE); constraint_.SetCurSel(item.range.type); if (item.range.type == RANGE_TYPE_NONE) { @@ -6326,11 +6328,14 @@ void ChgjsonDlg::set_control_status(const HGITEM& item) GetDlgItem(IDC_STATIC_TO)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_FROM)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_TO)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_EDIT_STEP)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_STATIC_STEP)->ShowWindow(SW_SHOW); if (item.type == L"int") { SetDlgItemInt(IDC_EDIT_FROM, item.range.lower); SetDlgItemInt(IDC_EDIT_TO, item.range.upper); + SetDlgItemInt(IDC_EDIT_STEP, item.range.step); } else { @@ -6341,6 +6346,9 @@ void ChgjsonDlg::set_control_status(const HGITEM& item) swprintf_s(buf, _countof(buf) - 1, L"%f", item.range.upper); ::SetDlgItemTextW(m_hWnd, IDC_EDIT_TO, buf); + + swprintf_s(buf, _countof(buf) - 1, L"%f", item.range.step); + ::SetDlgItemTextW(m_hWnd, IDC_EDIT_STEP, buf); } } else // list @@ -6449,11 +6457,13 @@ void* ChgjsonDlg::create_json(int item, std::vector* def_h, std::wstring* { r->set_value(L"min", (int)hg_items_[item].range.lower); r->set_value(L"max", (int)hg_items_[item].range.upper); + r->set_value(L"step", (int)hg_items_[item].range.step); } else { r->set_value(L"min", hg_items_[item].range.lower); r->set_value(L"max", hg_items_[item].range.upper); + r->set_value(L"step", hg_items_[item].range.step); } jsn->set_value(L"range", r); r->release(); @@ -6745,12 +6755,16 @@ void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent, bool { if (item.type == L"int") { - int l = 0, u = 0; + int l = 0, u = 0, s = 0; if (child->get_value(L"min", l)) { child->get_value(L"max", u); item.range.lower = l; item.range.upper = u; + if (child->get_value(L"step", s)) + item.range.step = s; + else + item.range.step = 1; item.range.type = RANGE_TYPE_RANGE; } else @@ -6775,6 +6789,8 @@ void ChgjsonDlg::add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent, bool if (child->get_value(L"min", item.range.lower)) { child->get_value(L"max", item.range.upper); + if (!child->get_value(L"step", item.range.step)) + item.range.step = (item.range.upper - item.range.lower) / 10.0f; item.range.type = RANGE_TYPE_RANGE; } else @@ -7385,6 +7401,8 @@ void ChgjsonDlg::OnCbnSelchangeConstraintType() GetDlgItem(IDC_STATIC_TO)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_FROM)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_TO)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_EDIT_STEP)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_STATIC_STEP)->ShowWindow(SW_HIDE); constraint_list_.ShowWindow(SW_HIDE); if (sel == 0) @@ -7406,6 +7424,8 @@ void ChgjsonDlg::OnCbnSelchangeConstraintType() GetDlgItem(IDC_EDIT_TO)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_DEFAULT)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_DEFAULT)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_EDIT_STEP)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_STATIC_STEP)->ShowWindow(SW_SHOW); } else // if( sel == 2) { @@ -7741,6 +7761,10 @@ void ChgjsonDlg::OnBnClickedButton4() it->range.lower = _wtof(str); ::GetDlgItemTextW(m_hWnd, IDC_EDIT_TO, str, _countof(str) - 1); it->range.upper = _wtof(str); + ::GetDlgItemTextW(m_hWnd, IDC_EDIT_STEP, str, _countof(str) - 1); + it->range.step = _wtof(str); + if (fabs(it->range.step) < .000001f) + it->range.step = (it->range.upper - it->range.lower) / 10.0f; } } diff --git a/tools/apps/hgjson/hgjsonDlg.h b/tools/apps/hgjson/hgjsonDlg.h index 603d9cc..4c4b99f 100644 --- a/tools/apps/hgjson/hgjsonDlg.h +++ b/tools/apps/hgjson/hgjsonDlg.h @@ -50,6 +50,7 @@ public: int type; double lower; double upper; + double step; std::vector queue; }RANGE; typedef struct _hg_item diff --git a/tools/apps/hgjson/resource.h b/tools/apps/hgjson/resource.h index 75f3a7c..460bd7b 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 f9ec08c..d4a844b 100644 Binary files a/tools/solution/Release/hgjson.exe and b/tools/solution/Release/hgjson.exe differ