diff --git a/docs/G100-G200.txt b/docs/G100-G200.txt index e4b9fa0..b180b9c 100644 --- a/docs/G100-G200.txt +++ b/docs/G100-G200.txt @@ -89,12 +89,12 @@ "title": " 背景色彩浮动范围", "desc": "设定背景色彩的浮动范围,在该范围内的都当作背景移除", "type": "int", - "cur": 10, - "default": 10, + "cur": 20, + "default": 20, "size": 4, "range": { "min": 1, - "max": 100 + "max": 128 }, "depend_or": ["8==true"] }, @@ -596,8 +596,8 @@ "52": { "category": "base", "name": "cfg-52", - "title": " 歪斜检测难易度", - "desc": "纸张歪斜检测难易度", + "title": " 歪斜容忍度", + "desc": "值越小,代表能检测到纸张的歪斜角度越小", "type": "int", "cur": 3, "default": 3, diff --git a/docs/G139-239.txt b/docs/G139-239.txt index 82227f9..00e94c8 100644 --- a/docs/G139-239.txt +++ b/docs/G139-239.txt @@ -89,12 +89,12 @@ "title": " 背景色彩浮动范围", "desc": "设定背景色彩的浮动范围,在该范围内的都当作背景移除", "type": "int", - "cur": 10, - "default": 10, + "cur": 20, + "default": 20, "size": 4, "range": { "min": 1, - "max": 100 + "max": 128 }, "depend_or": ["8==true"] }, @@ -363,7 +363,7 @@ "32": { "category": "base", "name": "cfg-32", - "title": "亮度", + "title": "亮度值", "desc": "调整图片亮度", "type": "int", "cur": 128, @@ -391,7 +391,7 @@ "34": { "category": "base", "name": "cfg-34", - "title": "伽马", + "title": "伽马值", "desc": "调整图片伽玛值", "type": "float", "cur": 1.000000, @@ -616,8 +616,8 @@ "54": { "category": "base", "name": "cfg-54", - "title": " 折角检测难易度", - "desc": "纸张折角检测复杂度", + "title": " 折角大小", + "desc": "值越小,代表能检测到的折角越小", "type": "int", "cur": 10, "default": 10, @@ -641,8 +641,8 @@ "56": { "category": "base", "name": "cfg-56", - "title": " 歪斜检测难易度", - "desc": "纸张歪斜检测复杂度", + "title": "歪斜容忍度", + "desc": "值越小,代表能检测到纸张的歪斜角度越小", "type": "int", "cur": 3, "default": 3, diff --git a/docs/G300.txt b/docs/G300.txt index a65d97f..4ac5dd5 100644 --- a/docs/G300.txt +++ b/docs/G300.txt @@ -89,12 +89,12 @@ "title": " 背景色彩浮动范围", "desc": "设定背景色彩的浮动范围,在该范围内的都当作背景移除", "type": "int", - "cur": 10, - "default": 10, + "cur": 20, + "default": 20, "size": 4, "range": { "min": 1, - "max": 100 + "max": 128 }, "depend_or": ["8==true"] }, @@ -340,7 +340,7 @@ "30": { "category": "base", "name": "cfg-30", - "title": "亮度", + "title": "亮度值", "desc": "调整图片亮度", "type": "int", "cur": 128, @@ -370,7 +370,7 @@ "32": { "category": "base", "name": "cfg-32", - "title": "伽马", + "title": "伽马值", "desc": "调整图片伽马值", "type": "float", "cur": 1.000000, diff --git a/docs/G400.txt b/docs/G400.txt index 379eac9..cb37192 100644 --- a/docs/G400.txt +++ b/docs/G400.txt @@ -89,12 +89,12 @@ "title": " 背景色彩浮动范围", "desc": "设定背景色彩的浮动范围,在该范围内的都当作背景移除", "type": "int", - "cur": 10, - "default": 10, + "cur": 20, + "default": 20, "size": 4, "range": { "min": 1, - "max": 40 + "max": 128 }, "depend_or": ["8==true"] }, @@ -340,7 +340,7 @@ "30": { "category": "base", "name": "cfg-30", - "title": "亮度", + "title": "亮度值", "desc": "调整图片亮度", "type": "int", "cur": 128, @@ -368,7 +368,7 @@ "32": { "category": "base", "name": "cfg-32", - "title": "伽马", + "title": "伽马值", "desc": "调整图片伽玛值", "type": "float", "cur": 1.000000, diff --git a/tools/apps/hgjson/hgjson.rc b/tools/apps/hgjson/hgjson.rc index 2c6e170..a6317ee 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 bdddb79..38b57ea 100644 --- a/tools/apps/hgjson/hgjsonDlg.cpp +++ b/tools/apps/hgjson/hgjsonDlg.cpp @@ -5802,6 +5802,7 @@ BEGIN_MESSAGE_MAP(ChgjsonDlg, CDialogEx) ON_NOTIFY(LVN_GETINFOTIP, IDC_LIST_VALUES, &ChgjsonDlg::OnLvnGetInfoTipListValues) ON_COMMAND(ID_TREE_TOOLTIPS, &ChgjsonDlg::OnTreeTooltips) ON_COMMAND(ID_LISTMENU_TOOLTIPS, &ChgjsonDlg::OnListmenuTooltips) + ON_COMMAND(ID_TREE_EXPORTCHAR, &ChgjsonDlg::OnTreeExportCharConstants) END_MESSAGE_MAP() @@ -5946,7 +5947,7 @@ void ChgjsonDlg::to_define_header(std::vector& defs, const wchar_t* str, c defs.push_back(h); } -void ChgjsonDlg::save_define_header_2_file(std::vector& defs, const wchar_t* file) +std::string ChgjsonDlg::save_define_header_2_file(std::vector& defs, const wchar_t* file) { int max_l = 0; std::wstring space(L""), @@ -5991,20 +5992,36 @@ void ChgjsonDlg::save_define_header_2_file(std::vector& defs, const wchar_ cont += L"\"" + defs[i].utf8_in_oct + L"\"\r\n"; } - // compare ... + // reserve ... + std::wstring reserve(L"#define OPTION_TITLE_GMZ"); + max_l += 8; + reserve += space.substr(0, max_l - reserve.length()); + reserve += L"OPTION_TITLE_JMZ\r\n"; + space.clear(); space.resize(max_l, L'/'); + cont += L"\r\n\r\n" + space + L"\r\n// reserved ...\r\n" + space + L"\r\n" + reserve; + + // compare ... cont += L"\r\n\r\n" + space + L"\r\n// string compare ...\r\n" + space + L"\r\n"; - cont += L"// bool is_opt_str_equal(const char* opt_define, const char* value)\r\n"; - cont += L"// {\r\n"; - cont += L"// \twhile(*value++ == L' ');\r\n"; - cont += L"// \tvalue--;\r\n"; - cont += L"// \treturn strcmp(opt_define, value) == 0;\r\n"; - cont += L"// }\r\n//\r\n\r\n"; + cont += L"#define IMPLEMENT_OPTION_STRING_COMPARE(func_name) \\\r\n"; + cont += L" bool func_name(const char* opt_define, const char* value) \\\r\n"; + cont += L" { \\\r\n"; + cont += L" while(*value++ == L' '); \\\r\n"; + cont += L" value--; \\\r\n"; + cont += L" return strcmp(opt_define, value) == 0; \\\r\n"; + cont += L" }\r\n\r\n\r\n"; std::string bom(""), utf8(coding::u2utf8(cont.c_str())); coding_util::bom::from_utf8(utf8.c_str(), utf8.length(), coding::get_string, &bom); - file_util::save_2_file(bom.c_str(), bom.length(), file); + if (file) + file_util::save_2_file(bom.c_str(), bom.length(), file); + else + { + file_util::set_clipboard(cont.c_str(), cont.length() * 2, CF_UNICODETEXT); + } + + return bom; } void ChgjsonDlg::init_control_statu(void) @@ -6359,7 +6376,7 @@ void* ChgjsonDlg::create_json(int item, std::vector* def_h) return jsn; } -std::string ChgjsonDlg::to_json_text(void) +std::string ChgjsonDlg::to_json_text(bool for_const) { known_file_util::IJsonW *jsn = known_file_util::create_jsonW(), *item = NULL; HTREEITEM root = tree_.GetRootItem(), child = NULL; @@ -6448,8 +6465,15 @@ std::string ChgjsonDlg::to_json_text(void) coding_util::unicode_2_utf8(val.c_str(), coding::get_string, &utf8); if (header.size()) { - ChgjsonDlg::save_define_header_2_file(header, file.c_str()); - file_util::display_file_in_explorer(file.c_str()); + if (for_const) + { + utf8 = ChgjsonDlg::save_define_header_2_file(header, NULL); + } + //else + //{ + // ChgjsonDlg::save_define_header_2_file(header, file.c_str()); + // file_util::display_file_in_explorer(file.c_str()); + //} } return utf8; @@ -7675,3 +7699,14 @@ void ChgjsonDlg::OnListmenuTooltips() // TODO: Add your command handler code here show_list_tooltips_ ^= true; } + + +void ChgjsonDlg::OnTreeExportCharConstants() +{ + // TODO: ڴ + std::string bom(to_json_text(true)); + if(bom.empty()) + MessageBox(TEXT("No char constant")); + else + MessageBox(TEXT("const string has set to clipboard already")); +} diff --git a/tools/apps/hgjson/hgjsonDlg.h b/tools/apps/hgjson/hgjsonDlg.h index 6a0f473..dba58bc 100644 --- a/tools/apps/hgjson/hgjsonDlg.h +++ b/tools/apps/hgjson/hgjsonDlg.h @@ -105,7 +105,7 @@ protected: DECLARE_MESSAGE_MAP() static void to_define_header(std::vector& defs, const wchar_t* str, const wchar_t* parent = NULL); - static void save_define_header_2_file(std::vector& defs, const wchar_t* file); + static std::string save_define_header_2_file(std::vector& defs, const wchar_t* file); // return BOM string void init_control_statu(void); void delete_tree_item(HTREEITEM root); @@ -114,7 +114,7 @@ protected: void set_control_status(const HGITEM& item); void* create_json(int item, std::vector *def_h = NULL); - std::string to_json_text(void); + std::string to_json_text(bool for_const = false); void add_item(void* jsn_root, void* jsn_obj, HTREEITEM parent); bool load_from_json_text(const wchar_t* txt); bool load_from_file(const wchar_t* path_file); @@ -160,6 +160,7 @@ public: afx_msg void OnLvnGetInfoTipListValues(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnTreeTooltips(); afx_msg void OnListmenuTooltips(); + afx_msg void OnTreeExportCharConstants(); }; diff --git a/tools/apps/hgjson/resource.h b/tools/apps/hgjson/resource.h index 9398193..f4550a9 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 33f57cd..5ebca39 100644 Binary files a/tools/solution/Release/hgjson.exe and b/tools/solution/Release/hgjson.exe differ