修复选择横向纸张时的界面显示问题

This commit is contained in:
gb 2023-10-19 11:35:06 +08:00
parent 80ffb60c34
commit 4b01b1adc9
2 changed files with 13 additions and 1 deletions

View File

@ -214,6 +214,15 @@ namespace sane_opt_trans
{ {
VALUE_TO_TWAIN(g_paper_map, val); VALUE_TO_TWAIN(g_paper_map, val);
std::string lat("\xe6\xa8\xaa\xe5\x90\x91"), // 横向
v(to_default_language(val, nullptr));
size_t pos = v.find(lat);
if (pos != std::string::npos)
{
v.erase(pos, lat.length());
VALUE_TO_TWAIN(g_paper_map, v.c_str());
}
return -1; return -1;
} }
const char* switch_paper_lateral(const char* val) const char* switch_paper_lateral(const char* val)

View File

@ -1950,6 +1950,7 @@ EX_OPTION_HANDLER_IMPL(paper)
int now = sane_opt_trans::paper_to_twain(buf), int now = sane_opt_trans::paper_to_twain(buf),
init = sane_opt_trans::paper_to_twain(def), init = sane_opt_trans::paper_to_twain(def),
val = 0; val = 0;
std::vector<int> exists;
local_utility::free_memory(def); local_utility::free_memory(def);
do do
@ -1960,8 +1961,10 @@ EX_OPTION_HANDLER_IMPL(paper)
{ {
value_role role = VAL_ROLE_NONE; value_role role = VAL_ROLE_NONE;
val = sane_opt_trans::paper_to_twain(desc->constraint.string_list[i]); val = sane_opt_trans::paper_to_twain(desc->constraint.string_list[i]);
if (val == -1) if (val == -1 || std::find(exists.begin(), exists.end(), val) != exists.end())
continue; continue;
exists.push_back(val);
if (val == now) if (val == now)
role = VAL_ROLE_CURRENT; role = VAL_ROLE_CURRENT;
if (val == init) if (val == init)