增加格式化输出JSON功能;修复更改name字段后界面刷新BUG

This commit is contained in:
gb 2024-03-23 14:44:27 +08:00
parent 44a4ac39d7
commit 4a057378e5
6 changed files with 31 additions and 5 deletions

View File

@ -28,7 +28,7 @@ static std::string crash_json[] = { "{\"dev-sn\":{\"cat\":\"Common\",\"group\":\
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// known name ... // known name ...
#include "../../../../code_device/sdk/base/huagaoxxx_warraper_ex.h" #include "../../../../code_device/hgdriver/wrapper/huagaoxxx_warraper_ex.h"
#include "opt_ui/DlgSetting.h" #include "opt_ui/DlgSetting.h"
#include "../../../../code_device/hgsane/sane_opt/sane_opts.h" #include "../../../../code_device/hgsane/sane_opt/sane_opts.h"
#include "../../../../code_device/sdk/sane_opt_json/device_opt.h" #include "../../../../code_device/sdk/sane_opt_json/device_opt.h"
@ -2041,6 +2041,7 @@ BOOL CDlgOptJson::OnInitDialog()
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_CATEGORY), L"\u5C5E\u6027\u5206\u7C7B\u3002\u5982\u679C\u4E3A\u56FE\u50CF\u5206\u7C7B\uFF0C\u4F1A\u6309\u7167\u201Cposition\u201D\u503C\u6392\u5E8F\uFF0C\u4EE5\u786E\u5B9A\u6267\u884C\u7684\u5148\u540E\u987A\u5E8F"); tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_CATEGORY), L"\u5C5E\u6027\u5206\u7C7B\u3002\u5982\u679C\u4E3A\u56FE\u50CF\u5206\u7C7B\uFF0C\u4F1A\u6309\u7167\u201Cposition\u201D\u503C\u6392\u5E8F\uFF0C\u4EE5\u786E\u5B9A\u6267\u884C\u7684\u5148\u540E\u987A\u5E8F");
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_GROUP), L"\u8BE5\u5C5E\u6027\u5728\u754C\u9762\u4E0A\u663E\u793A\u65F6\uFF0C\u6240\u5F52\u5C5E\u7684\u5206\u7EC4\u540D\u79F0"); tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_GROUP), L"\u8BE5\u5C5E\u6027\u5728\u754C\u9762\u4E0A\u663E\u793A\u65F6\uFF0C\u6240\u5F52\u5C5E\u7684\u5206\u7EC4\u540D\u79F0");
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_AUTH), L"\u64CD\u4F5C\u8BE5\u5C5E\u6027\u6240\u9700\u8981\u7684\u6700\u4F4E\u6743\u9650"); tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_AUTH), L"\u64CD\u4F5C\u8BE5\u5C5E\u6027\u6240\u9700\u8981\u7684\u6700\u4F4E\u6743\u9650");
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_COMBO_DATA_TYPE), L"\u6570\u7EC4\u8BF7\u9009\u62E9\u201Cint\u201D \u6216\u8005\u201Cfloat\u201D\u7C7B\u578B\uFF0C\u7136\u540E\u5728\u201Csize\u201D\u91CC\u9762\u586B\u5165\u9700\u8981\u7684\u5B9E\u9645\u5B57\u8282\u6570\uFF08\u5FC5\u987B\u4E3A4\u7684\u6574\u6570\u500D\uFF09");
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_EDIT_FIXED_ID), L"\u63D0\u4F9B\u8BE5\u503C\uFF0C\u8BE5\u5C5E\u6027\u5373\u53EF\u88ABTWAIN\u534F\u8BAE\u4FA6\u6D4B\u5230"); tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_EDIT_FIXED_ID), L"\u63D0\u4F9B\u8BE5\u503C\uFF0C\u8BE5\u5C5E\u6027\u5373\u53EF\u88ABTWAIN\u534F\u8BAE\u4FA6\u6D4B\u5230");
tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_EDIT_POSITION), L"\u76F8\u540C\u5206\u7C7B\u201CCategory\u201D\u4E2D\u5C5E\u6027\u7684\u6267\u884C\u987A\u5E8F\uFF0C\u6570\u5B57\u8D8A\u5C0F\u6392\u5728\u8D8A\u524D\u9762\u6267\u884C\u3002\u5982\u679C\u5C5E\u6027ID\u76F8\u540C\uFF0C\u5219\u6309\u8BE5\u503C\u987A\u5E8F\u6267\u884C\uFF1B\u5982\u679C\u8BE5\u503C\u4E5F\u76F8\u540C\uFF0C\u5219\u6309\u6700\u8FD1\u6DFB\u52A0\u7684\u5C5E\u6027\u66FF\u6362\u4E4B\u524D\u7684\u6267\u884C\u3002"); tooltips_->add_tool_tip_for_ctrl(::GetDlgItem(m_hWnd, IDC_EDIT_POSITION), L"\u76F8\u540C\u5206\u7C7B\u201CCategory\u201D\u4E2D\u5C5E\u6027\u7684\u6267\u884C\u987A\u5E8F\uFF0C\u6570\u5B57\u8D8A\u5C0F\u6392\u5728\u8D8A\u524D\u9762\u6267\u884C\u3002\u5982\u679C\u5C5E\u6027ID\u76F8\u540C\uFF0C\u5219\u6309\u8BE5\u503C\u987A\u5E8F\u6267\u884C\uFF1B\u5982\u679C\u8BE5\u503C\u4E5F\u76F8\u540C\uFF0C\u5219\u6309\u6700\u8FD1\u6DFB\u52A0\u7684\u5C5E\u6027\u66FF\u6362\u4E4B\u524D\u7684\u6267\u884C\u3002");
@ -2447,8 +2448,33 @@ 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) 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)
{ {
std::wstring old(v.name);
sop.range = std::move(v.range); sop.range = std::move(v.range);
v = std::move(sop); v = std::move(sop);
HTREEITEM item = tree_.GetSelectedItem();
wchar_t *name = (wchar_t*)tree_.GetItemData(item);
if (old != name)
{
name = nullptr;
item = tree_.GetChildItem(tree_.GetRootItem());
while (item)
{
name = (wchar_t*)tree_.GetItemData(item);
if (old == name)
break;
name = nullptr;
item = tree_.GetNextSiblingItem(item);
}
}
if (name)
{
delete[] name;
name = new wchar_t[v.name.length() + 1];
wcscpy(name, v.name.c_str());
tree_.SetItemData(item, (DWORD_PTR)name);
}
} }
return; return;
} }
@ -3645,7 +3671,7 @@ namespace test_sane_ui
typedef struct _sane_objects typedef struct _sane_objects
{ {
device_option *dev_opt; device_option *dev_opt;
sane_options *sane_opt; sane_option_mgr *sane_opt;
}SANEOBJ, *LPSANEOBJ; }SANEOBJ, *LPSANEOBJ;
static void print_err(const char* msg) static void print_err(const char* msg)
{ {
@ -3897,7 +3923,7 @@ void CDlgOptJson::OnBnClickedButtonShowui()
_CrtMemCheckpoint(&bgn); _CrtMemCheckpoint(&bgn);
sane.dev_opt = new device_option(); sane.dev_opt = new device_option();
sane.sane_opt = new sane_options(); sane.sane_opt = new sane_option_mgr();
test_sane_ui::sane_box* box = new test_sane_ui::sane_box(&utf8[0]); test_sane_ui::sane_box* box = new test_sane_ui::sane_box(&utf8[0]);
text.clear(); text.clear();
if (sane.dev_opt->add(box)) if (sane.dev_opt->add(box))

View File

@ -44,14 +44,14 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\sdk\Include\;$(ProjectDir)..\..\..\..\sdk\Include\;$(ProjectDir)..\..\..\..\code_device\sdk\;$(ProjectDir)..\..\..\..\code_device\hgsane\sane_opt\;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)..\..\..\..\code_device\sdk\;$(ProjectDir)..\..\..\..\code_device\hgsane\sane_opt\;$(ProjectDir)..\..\sdk\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\..\sdk\lib\;$(ProjectDir)..\..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)..\..\sdk\lib\;$(ProjectDir)..\..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao;$(LibraryPath)</LibraryPath>
<IntDir>$(OutDir)$(ProjectName)\</IntDir> <IntDir>$(OutDir)$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\..\solution\$(Configuration)\</OutDir> <OutDir>$(ProjectDir)..\..\solution\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\sdk\Include\;$(ProjectDir)..\..\..\..\sdk\Include\;$(ProjectDir)..\..\..\..\code_device\sdk\;$(ProjectDir)..\..\..\..\code_device\hgsane\sane_opt\;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)..\..\sdk\Include\;$(ProjectDir)..\..\..\..\code_device\sdk\;$(ProjectDir)..\..\..\..\code_device\hgsane\sane_opt\;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)..\..\sdk\lib\;$(ProjectDir)..\..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)..\..\sdk\lib\;$(ProjectDir)..\..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao;$(LibraryPath)</LibraryPath>
<IntDir>$(OutDir)$(ProjectName)\</IntDir> <IntDir>$(OutDir)$(ProjectName)\</IntDir>
<OutDir>$(ProjectDir)..\..\solution\$(Configuration)\</OutDir> <OutDir>$(ProjectDir)..\..\solution\$(Configuration)\</OutDir>

Binary file not shown.

Binary file not shown.

Binary file not shown.