增加配置版本信息;修复浮点型数值获取BUG
This commit is contained in:
parent
9677f8354f
commit
b764b210e9
|
@ -889,10 +889,9 @@ void* dlg_page::value_from_ctrl(HWND ctrl, SANE_Value_Type* type)
|
||||||
else if (cmpstr(cls, WC_EDITW) == 0 || cmpstr(cls, WC_COMBOBOXW) == 0)
|
else if (cmpstr(cls, WC_EDITW) == 0 || cmpstr(cls, WC_COMBOBOXW) == 0)
|
||||||
{
|
{
|
||||||
int len = (int)GetPropW(host, dlg_page::property_size.c_str());
|
int len = (int)GetPropW(host, dlg_page::property_size.c_str());
|
||||||
wchar_t* buf = new wchar_t[len + 2];
|
wchar_t* buf = new wchar_t[len + 8];
|
||||||
|
|
||||||
GetWindowTextW(ctrl, buf, len);
|
GetWindowTextW(ctrl, buf, len + 6);
|
||||||
buf[len] = 0;
|
|
||||||
if (tp == SANE_TYPE_INT)
|
if (tp == SANE_TYPE_INT)
|
||||||
{
|
{
|
||||||
ret = new char[sizeof(SANE_Int)];
|
ret = new char[sizeof(SANE_Int)];
|
||||||
|
@ -905,6 +904,7 @@ void* dlg_page::value_from_ctrl(HWND ctrl, SANE_Value_Type* type)
|
||||||
}
|
}
|
||||||
else if (tp == SANE_TYPE_STRING)
|
else if (tp == SANE_TYPE_STRING)
|
||||||
{
|
{
|
||||||
|
buf[len] = 0;
|
||||||
std::string utf8(local_trans::u2a(buf, CP_UTF8));
|
std::string utf8(local_trans::u2a(buf, CP_UTF8));
|
||||||
ret = new char[len + 2];
|
ret = new char[len + 2];
|
||||||
if ((int)utf8.length() > len)
|
if ((int)utf8.length() > len)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "../../sdk/include/huagao/brand.h"
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN64)
|
#if defined(WIN32) || defined(_WIN64)
|
||||||
#define bzero(b, s) memset(b, 0, s)
|
#define bzero(b, s) memset(b, 0, s)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1067,6 +1069,12 @@ namespace gb
|
||||||
{
|
{
|
||||||
if (jsn_)
|
if (jsn_)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
char ver[40] = { 0 };
|
||||||
|
sprintf_s(ver, "%u.%u", VERSION_MAIN, VERSION_SUB);
|
||||||
|
jsn_->set_value("ver", ver);
|
||||||
|
}
|
||||||
|
|
||||||
std::string cont(jsn_->to_string(false)), encode("");
|
std::string cont(jsn_->to_string(false)), encode("");
|
||||||
gb::base64 b64;
|
gb::base64 b64;
|
||||||
|
|
||||||
|
|
|
@ -979,6 +979,8 @@ 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;
|
||||||
|
|
||||||
|
local_utility::free_memory(def);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (desc->constraint_type == SANE_CONSTRAINT_STRING_LIST)
|
if (desc->constraint_type == SANE_CONSTRAINT_STRING_LIST)
|
||||||
|
@ -1176,6 +1178,7 @@ EX_OPTION_HANDLER_IMPL(duplex)
|
||||||
setv(&val, VAL_ROLE_DEFAULT, data);
|
setv(&val, VAL_ROLE_DEFAULT, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
local_utility::free_memory(init);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -444,6 +444,14 @@ static void copy_type(bool& to, Bool from)
|
||||||
{
|
{
|
||||||
to = (bool)from;
|
to = (bool)from;
|
||||||
}
|
}
|
||||||
|
static void copy_type(BYTE& to, bool from)
|
||||||
|
{
|
||||||
|
to = from;
|
||||||
|
}
|
||||||
|
static void copy_type(bool& to, BYTE from)
|
||||||
|
{
|
||||||
|
to = (bool)from;
|
||||||
|
}
|
||||||
static void copy_type(UInt32& to, int from)
|
static void copy_type(UInt32& to, int from)
|
||||||
{
|
{
|
||||||
to = from;
|
to = from;
|
||||||
|
@ -2683,7 +2691,7 @@ void huagao_ds::init_support_caps_ex(void)
|
||||||
{ \
|
{ \
|
||||||
if(type == VAL_TYPE_BOOL) \
|
if(type == VAL_TYPE_BOOL) \
|
||||||
{ \
|
{ \
|
||||||
SET_SANE_CAP(bool, Bool, name) \
|
SET_SANE_CAP(bool, BYTE, name) \
|
||||||
} \
|
} \
|
||||||
else if(type == VAL_TYPE_INT) \
|
else if(type == VAL_TYPE_INT) \
|
||||||
{ \
|
{ \
|
||||||
|
|
Loading…
Reference in New Issue