configure: Disable sane.ds if the Unix library is missing.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
80a30625a7
commit
cf5bad0ecc
|
@ -13313,14 +13313,14 @@ ac_save_CPPFLAGS=$CPPFLAGS
|
||||||
CPPFLAGS="$CPPFLAGS $SANE_CFLAGS"
|
CPPFLAGS="$CPPFLAGS $SANE_CFLAGS"
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "sane/sane.h" "ac_cv_header_sane_sane_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "sane/sane.h" "ac_cv_header_sane_sane_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_sane_sane_h" = xyes; then :
|
if test "x$ac_cv_header_sane_sane_h" = xyes; then :
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lsane" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sane_init in -lsane" >&5
|
||||||
$as_echo_n "checking for -lsane... " >&6; }
|
$as_echo_n "checking for sane_init in -lsane... " >&6; }
|
||||||
if ${ac_cv_lib_soname_sane+:} false; then :
|
if ${ac_cv_lib_sane_sane_init+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_check_soname_save_LIBS=$LIBS
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
LIBS="-lsane $SANE_LIBS $LIBS"
|
LIBS="-lsane $SANE_LIBS $LIBS"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
/* Override any GCC internal prototype to avoid an error.
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
@ -13339,37 +13339,20 @@ return sane_init ();
|
||||||
}
|
}
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
case "$LIBEXT" in
|
ac_cv_lib_sane_sane_init=yes
|
||||||
dll) ac_cv_lib_soname_sane=`$ac_cv_path_LDD conftest.exe | grep "sane" | sed -e "s/dll.*/dll/"';2,$d'` ;;
|
|
||||||
dylib) ac_cv_lib_soname_sane=`$OTOOL -L conftest$ac_exeext | grep "libsane\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libsane\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
|
|
||||||
*) ac_cv_lib_soname_sane=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libsane\\.$LIBEXT" | sed -e "s/^.*\\[\\(libsane\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
|
|
||||||
if ${ac_cv_lib_soname_sane:+false} :; then :
|
|
||||||
ac_cv_lib_soname_sane=`$LDD conftest$ac_exeext | grep "libsane\\.$LIBEXT" | sed -e "s/^.*\(libsane\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
else
|
else
|
||||||
ac_cv_lib_soname_sane=
|
ac_cv_lib_sane_sane_init=no
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS=$ac_check_soname_save_LIBS
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
fi
|
fi
|
||||||
if ${ac_cv_lib_soname_sane:+false} :; then :
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sane_sane_init" >&5
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
|
$as_echo "$ac_cv_lib_sane_sane_init" >&6; }
|
||||||
$as_echo "not found" >&6; }
|
if test "x$ac_cv_lib_sane_sane_init" = xyes; then :
|
||||||
SANE_CFLAGS=""
|
:
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_sane" >&5
|
|
||||||
$as_echo "$ac_cv_lib_soname_sane" >&6; }
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define SONAME_LIBSANE "$ac_cv_lib_soname_sane"
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
SANE_CFLAGS=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -13383,7 +13366,7 @@ if test "x$ac_cv_lib_soname_sane" = "x"; then :
|
||||||
*) as_fn_error $? "libsane ${notice_platform}development files not found, scanners won't be supported.
|
*) as_fn_error $? "libsane ${notice_platform}development files not found, scanners won't be supported.
|
||||||
This is an error since --with-sane was requested." "$LINENO" 5 ;;
|
This is an error since --with-sane was requested." "$LINENO" 5 ;;
|
||||||
esac
|
esac
|
||||||
|
enable_sane_ds=${enable_sane_ds:-no}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$with_usb" != "xno"
|
if test "x$with_usb" != "xno"
|
||||||
|
|
|
@ -1347,11 +1347,11 @@ if test "x$with_sane" != "xno"
|
||||||
then
|
then
|
||||||
WINE_PACKAGE_FLAGS(SANE,[sane-backends],,[`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`],[`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`],
|
WINE_PACKAGE_FLAGS(SANE,[sane-backends],,[`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`],[`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`],
|
||||||
[AC_CHECK_HEADER(sane/sane.h,
|
[AC_CHECK_HEADER(sane/sane.h,
|
||||||
[WINE_CHECK_SONAME(sane,sane_init,,[SANE_CFLAGS=""],[$SANE_LIBS])],
|
[AC_CHECK_LIB(sane,sane_init,[:],,[$SANE_LIBS])])])
|
||||||
[SANE_CFLAGS=""])])
|
|
||||||
fi
|
fi
|
||||||
WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
|
WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
|
||||||
[libsane ${notice_platform}development files not found, scanners won't be supported.])
|
[libsane ${notice_platform}development files not found, scanners won't be supported.],
|
||||||
|
[enable_sane_ds])
|
||||||
|
|
||||||
dnl **** Check for libusb ****
|
dnl **** Check for libusb ****
|
||||||
if test "x$with_usb" != "xno"
|
if test "x$with_usb" != "xno"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
MODULE = sane.ds
|
MODULE = sane.ds
|
||||||
IMPORTS = comctl32 user32 gdi32
|
IMPORTS = comctl32 user32 gdi32
|
||||||
|
EXTRALIBS = $(SANE_LIBS)
|
||||||
EXTRAINCL = $(SANE_CFLAGS)
|
EXTRAINCL = $(SANE_CFLAGS)
|
||||||
|
|
||||||
EXTRADLLFLAGS = -mcygwin
|
EXTRADLLFLAGS = -mcygwin
|
||||||
|
|
|
@ -129,7 +129,6 @@ static TW_UINT16 msg_get_enum(pTW_CAPABILITY pCapability, const TW_UINT32 *value
|
||||||
return TWCC_SUCCESS;
|
return TWCC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static TW_UINT16 msg_get_range(pTW_CAPABILITY pCapability, TW_UINT16 type,
|
static TW_UINT16 msg_get_range(pTW_CAPABILITY pCapability, TW_UINT16 type,
|
||||||
TW_UINT32 minval, TW_UINT32 maxval, TW_UINT32 step, TW_UINT32 def, TW_UINT32 current)
|
TW_UINT32 minval, TW_UINT32 maxval, TW_UINT32 step, TW_UINT32 def, TW_UINT32 current)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +154,6 @@ static TW_UINT16 msg_get_range(pTW_CAPABILITY pCapability, TW_UINT16 type,
|
||||||
GlobalUnlock(pCapability->hContainer);
|
GlobalUnlock(pCapability->hContainer);
|
||||||
return TWCC_SUCCESS;
|
return TWCC_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static TW_UINT16 TWAIN_GetSupportedCaps(pTW_CAPABILITY pCapability)
|
static TW_UINT16 TWAIN_GetSupportedCaps(pTW_CAPABILITY pCapability)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +271,6 @@ static TW_UINT16 SANE_CAPXferCount (pTW_CAPABILITY pCapability, TW_UINT16 action
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static BOOL pixeltype_to_sane_mode(TW_UINT16 pixeltype, SANE_String mode, int len)
|
static BOOL pixeltype_to_sane_mode(TW_UINT16 pixeltype, SANE_String mode, int len)
|
||||||
{
|
{
|
||||||
SANE_String_Const m = NULL;
|
SANE_String_Const m = NULL;
|
||||||
|
@ -309,13 +306,11 @@ static BOOL sane_mode_to_pixeltype(SANE_String_Const mode, TW_UINT16 *pixeltype)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ICAP_PIXELTYPE */
|
/* ICAP_PIXELTYPE */
|
||||||
static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT32 possible_values[3];
|
TW_UINT32 possible_values[3];
|
||||||
int possible_value_count;
|
int possible_value_count;
|
||||||
TW_UINT32 val;
|
TW_UINT32 val;
|
||||||
|
@ -382,7 +377,7 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return sane_status_to_twcc(rc);
|
return sane_status_to_twcc(rc);
|
||||||
if (status & SANE_INFO_RELOAD_PARAMS)
|
if (status & SANE_INFO_RELOAD_PARAMS)
|
||||||
psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
sane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -406,7 +401,7 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return sane_status_to_twcc(rc);
|
return sane_status_to_twcc(rc);
|
||||||
if (status & SANE_INFO_RELOAD_PARAMS)
|
if (status & SANE_INFO_RELOAD_PARAMS)
|
||||||
psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
sane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
||||||
|
|
||||||
/* .. fall through intentional .. */
|
/* .. fall through intentional .. */
|
||||||
|
|
||||||
|
@ -416,7 +411,6 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +461,6 @@ static TW_UINT16 SANE_ICAPUnits (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT32 possible_values[1];
|
TW_UINT32 possible_values[1];
|
||||||
|
|
||||||
TRACE("ICAP_BITDEPTH\n");
|
TRACE("ICAP_BITDEPTH\n");
|
||||||
|
@ -494,7 +487,6 @@ static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
twCC = set_onevalue(pCapability, TWTY_UINT16, activeDS.sane_param.depth);
|
twCC = set_onevalue(pCapability, TWTY_UINT16, activeDS.sane_param.depth);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +557,6 @@ static TW_UINT16 SANE_ICAPCompression (pTW_CAPABILITY pCapability, TW_UINT16 act
|
||||||
static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
|
static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT32 val;
|
TW_UINT32 val;
|
||||||
SANE_Int current_resolution;
|
SANE_Int current_resolution;
|
||||||
TW_FIX32 *default_res;
|
TW_FIX32 *default_res;
|
||||||
|
@ -659,7 +650,6 @@ static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 acti
|
||||||
twCC = set_onevalue(pCapability, TWTY_FIX32, current_resolution);
|
twCC = set_onevalue(pCapability, TWTY_FIX32, current_resolution);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +657,6 @@ static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 acti
|
||||||
static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
|
static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_FIX32 res;
|
TW_FIX32 res;
|
||||||
char option_name[64];
|
char option_name[64];
|
||||||
SANE_Fixed lower, upper;
|
SANE_Fixed lower, upper;
|
||||||
|
@ -708,7 +697,6 @@ static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action
|
||||||
twCC = set_onevalue(pCapability, TWTY_FIX32, res.Whole | (res.Frac << 16));
|
twCC = set_onevalue(pCapability, TWTY_FIX32, res.Whole | (res.Frac << 16));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +704,6 @@ static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action
|
||||||
static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static const TW_UINT32 possible_values[] = { TWPF_CHOCOLATE, TWPF_VANILLA };
|
static const TW_UINT32 possible_values[] = { TWPF_CHOCOLATE, TWPF_VANILLA };
|
||||||
TW_UINT32 val;
|
TW_UINT32 val;
|
||||||
TW_UINT32 flavor = activeDS.sane_param.depth == 1 ? TWPF_VANILLA : TWPF_CHOCOLATE;
|
TW_UINT32 flavor = activeDS.sane_param.depth == 1 ? TWPF_VANILLA : TWPF_CHOCOLATE;
|
||||||
|
@ -754,11 +741,9 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
|
||||||
twCC = set_onevalue(pCapability, TWTY_UINT16, flavor);
|
twCC = set_onevalue(pCapability, TWTY_UINT16, flavor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static TW_UINT16 get_width_height(double *width, double *height, BOOL max)
|
static TW_UINT16 get_width_height(double *width, double *height, BOOL max)
|
||||||
{
|
{
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -911,13 +896,11 @@ static TW_UINT16 get_current_paper_size(const supported_size_t *s, int n)
|
||||||
|
|
||||||
return TWSS_NONE;
|
return TWSS_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ICAP_SUPPORTEDSIZES */
|
/* ICAP_SUPPORTEDSIZES */
|
||||||
static TW_UINT16 SANE_ICAPSupportedSizes (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_ICAPSupportedSizes (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
|
|
||||||
static TW_UINT32 possible_values[ARRAY_SIZE(supported_sizes)];
|
static TW_UINT32 possible_values[ARRAY_SIZE(supported_sizes)];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -975,7 +958,6 @@ static TW_UINT16 SANE_ICAPSupportedSizes (pTW_CAPABILITY pCapability, TW_UINT16
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,7 +965,6 @@ static TW_UINT16 SANE_ICAPSupportedSizes (pTW_CAPABILITY pCapability, TW_UINT16
|
||||||
static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT32 val;
|
TW_UINT32 val;
|
||||||
SANE_Bool autofeed;
|
SANE_Bool autofeed;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -1016,7 +997,7 @@ static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
status = sane_option_set_bool(activeDS.deviceHandle, "batch-scan", autofeed, NULL);
|
status = sane_option_set_bool(activeDS.deviceHandle, "batch-scan", autofeed, NULL);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
ERR("Error %s: Could not set batch-scan to %d\n", psane_strstatus(status), autofeed);
|
ERR("Error %s: Could not set batch-scan to %d\n", sane_strstatus(status), autofeed);
|
||||||
return sane_status_to_twcc(status);
|
return sane_status_to_twcc(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1012,7 @@ static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
status = sane_option_set_bool(activeDS.deviceHandle, "batch-scan", autofeed, NULL);
|
status = sane_option_set_bool(activeDS.deviceHandle, "batch-scan", autofeed, NULL);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
ERR("Error %s: Could not reset batch-scan to SANE_TRUE\n", psane_strstatus(status));
|
ERR("Error %s: Could not reset batch-scan to SANE_TRUE\n", sane_strstatus(status));
|
||||||
return sane_status_to_twcc(status);
|
return sane_status_to_twcc(status);
|
||||||
}
|
}
|
||||||
/* .. fall through intentional .. */
|
/* .. fall through intentional .. */
|
||||||
|
@ -1040,7 +1021,6 @@ static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
twCC = set_onevalue(pCapability, TWTY_BOOL, autofeed);
|
twCC = set_onevalue(pCapability, TWTY_BOOL, autofeed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1028,6 @@ static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
{
|
{
|
||||||
TW_UINT16 twCC = TWCC_BADCAP;
|
TW_UINT16 twCC = TWCC_BADCAP;
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT32 val;
|
TW_UINT32 val;
|
||||||
TW_BOOL enabled;
|
TW_BOOL enabled;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -1088,7 +1067,7 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac
|
||||||
}
|
}
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
ERR("Error %s: Could not set source to either ADF or Auto\n", psane_strstatus(status));
|
ERR("Error %s: Could not set source to either ADF or Auto\n", sane_strstatus(status));
|
||||||
return sane_status_to_twcc(status);
|
return sane_status_to_twcc(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1087,6 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac
|
||||||
twCC = set_onevalue(pCapability, TWTY_BOOL, enabled);
|
twCC = set_onevalue(pCapability, TWTY_BOOL, enabled);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1210,7 +1188,6 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
|
||||||
return twCC;
|
return twCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
TW_UINT16 SANE_SaneSetDefaults (void)
|
TW_UINT16 SANE_SaneSetDefaults (void)
|
||||||
{
|
{
|
||||||
TW_CAPABILITY cap;
|
TW_CAPABILITY cap;
|
||||||
|
@ -1238,4 +1215,3 @@ TW_UINT16 SANE_SaneSetDefaults (void)
|
||||||
|
|
||||||
return TWCC_SUCCESS;
|
return TWCC_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -199,9 +199,6 @@ TW_UINT16 SANE_ProcessEvent (pTW_IDENTITY pOrigin,
|
||||||
TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -219,10 +216,10 @@ TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin,
|
||||||
activeDS.currentState = 6;
|
activeDS.currentState = 6;
|
||||||
if (! activeDS.sane_started)
|
if (! activeDS.sane_started)
|
||||||
{
|
{
|
||||||
status = psane_start (activeDS.deviceHandle);
|
status = sane_start (activeDS.deviceHandle);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
TRACE("PENDINGXFERS/MSG_ENDXFER sane_start returns %s\n", psane_strstatus(status));
|
TRACE("PENDINGXFERS/MSG_ENDXFER sane_start returns %s\n", sane_strstatus(status));
|
||||||
pPendingXfers->Count = 0;
|
pPendingXfers->Count = 0;
|
||||||
activeDS.currentState = 5;
|
activeDS.currentState = 5;
|
||||||
/* Notify the application that it can close the data source */
|
/* Notify the application that it can close the data source */
|
||||||
|
@ -236,16 +233,12 @@ TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin,
|
||||||
}
|
}
|
||||||
|
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_GET */
|
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_GET */
|
||||||
TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -262,10 +255,10 @@ TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin,
|
||||||
pPendingXfers->Count = -1;
|
pPendingXfers->Count = -1;
|
||||||
if (! activeDS.sane_started)
|
if (! activeDS.sane_started)
|
||||||
{
|
{
|
||||||
status = psane_start (activeDS.deviceHandle);
|
status = sane_start (activeDS.deviceHandle);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
TRACE("PENDINGXFERS/MSG_GET sane_start returns %s\n", psane_strstatus(status));
|
TRACE("PENDINGXFERS/MSG_GET sane_start returns %s\n", sane_strstatus(status));
|
||||||
pPendingXfers->Count = 0;
|
pPendingXfers->Count = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -276,16 +269,12 @@ TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin,
|
||||||
}
|
}
|
||||||
|
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET */
|
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET */
|
||||||
TW_UINT16 SANE_PendingXfersReset (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_PendingXfersReset (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
||||||
|
|
||||||
|
@ -305,22 +294,18 @@ TW_UINT16 SANE_PendingXfersReset (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
if (activeDS.sane_started)
|
if (activeDS.sane_started)
|
||||||
{
|
{
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET */
|
/* DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET */
|
||||||
TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
|
pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
|
||||||
|
|
||||||
TRACE("DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET\n");
|
TRACE("DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET\n");
|
||||||
|
@ -339,7 +324,6 @@ TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
}
|
}
|
||||||
|
|
||||||
return TWRC_SUCCESS;
|
return TWRC_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_CONTROL/DAT_STATUS/MSG_GET */
|
/* DG_CONTROL/DAT_STATUS/MSG_GET */
|
||||||
|
@ -406,13 +390,11 @@ TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
|
||||||
{
|
{
|
||||||
SANE_Notify(MSG_CLOSEDSREQ);
|
SANE_Notify(MSG_CLOSEDSREQ);
|
||||||
}
|
}
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
sane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
||||||
activeDS.sane_param_valid = TRUE;
|
activeDS.sane_param_valid = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,9 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
||||||
TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_IMAGEINFO pImageInfo = (pTW_IMAGEINFO) pData;
|
pTW_IMAGEINFO pImageInfo = (pTW_IMAGEINFO) pData;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -52,12 +49,12 @@ TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
|
||||||
if (activeDS.currentState == 6)
|
if (activeDS.currentState == 6)
|
||||||
{
|
{
|
||||||
/* return general image description information about the image about to be transferred */
|
/* return general image description information about the image about to be transferred */
|
||||||
status = psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
status = sane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
||||||
TRACE("Getting parameters\n");
|
TRACE("Getting parameters\n");
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
WARN("psane_get_parameters: %s\n", psane_strstatus (status));
|
WARN("sane_get_parameters: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -109,16 +106,12 @@ TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
|
||||||
}
|
}
|
||||||
|
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GET */
|
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GET */
|
||||||
TW_UINT16 SANE_ImageLayoutGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_ImageLayoutGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_IMAGELAYOUT *img = (TW_IMAGELAYOUT *) pData;
|
TW_IMAGELAYOUT *img = (TW_IMAGELAYOUT *) pData;
|
||||||
SANE_Fixed tlx_current;
|
SANE_Fixed tlx_current;
|
||||||
SANE_Fixed tly_current;
|
SANE_Fixed tly_current;
|
||||||
|
@ -155,7 +148,6 @@ TW_UINT16 SANE_ImageLayoutGet (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
activeDS.twCC = TWCC_SUCCESS;
|
activeDS.twCC = TWCC_SUCCESS;
|
||||||
return TWRC_SUCCESS;
|
return TWRC_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GETDEFAULT */
|
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_GETDEFAULT */
|
||||||
|
@ -176,7 +168,6 @@ TW_UINT16 SANE_ImageLayoutReset (pTW_IDENTITY pOrigin,
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static TW_UINT16 set_one_imagecoord(const char *option_name, TW_FIX32 val, BOOL *changed)
|
static TW_UINT16 set_one_imagecoord(const char *option_name, TW_FIX32 val, BOOL *changed)
|
||||||
{
|
{
|
||||||
double d = val.Whole + ((double) val.Frac / 65536.0);
|
double d = val.Whole + ((double) val.Frac / 65536.0);
|
||||||
|
@ -193,15 +184,11 @@ static TW_UINT16 set_one_imagecoord(const char *option_name, TW_FIX32 val, BOOL
|
||||||
*changed = TRUE;
|
*changed = TRUE;
|
||||||
return TWRC_SUCCESS;
|
return TWRC_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET */
|
/* DG_IMAGE/DAT_IMAGELAYOUT/MSG_SET */
|
||||||
TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_IMAGELAYOUT *img = (TW_IMAGELAYOUT *) pData;
|
TW_IMAGELAYOUT *img = (TW_IMAGELAYOUT *) pData;
|
||||||
BOOL changed = FALSE;
|
BOOL changed = FALSE;
|
||||||
TW_UINT16 twrc;
|
TW_UINT16 twrc;
|
||||||
|
@ -231,16 +218,12 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
activeDS.twCC = TWCC_SUCCESS;
|
activeDS.twCC = TWCC_SUCCESS;
|
||||||
return changed ? TWRC_CHECKSTATUS : TWRC_SUCCESS;
|
return changed ? TWRC_CHECKSTATUS : TWRC_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DG_IMAGE/DAT_IMAGEMEMXFER/MSG_GET */
|
/* DG_IMAGE/DAT_IMAGEMEMXFER/MSG_GET */
|
||||||
TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_IMAGEMEMXFER pImageMemXfer = (pTW_IMAGEMEMXFER) pData;
|
pTW_IMAGEMEMXFER pImageMemXfer = (pTW_IMAGEMEMXFER) pData;
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
SANE_Status status = SANE_STATUS_GOOD;
|
||||||
|
@ -271,25 +254,25 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
if (! activeDS.sane_started)
|
if (! activeDS.sane_started)
|
||||||
{
|
{
|
||||||
status = psane_start (activeDS.deviceHandle);
|
status = sane_start (activeDS.deviceHandle);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
WARN("psane_start: %s\n", psane_strstatus (status));
|
WARN("sane_start: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
activeDS.sane_started = TRUE;
|
activeDS.sane_started = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = psane_get_parameters (activeDS.deviceHandle,
|
status = sane_get_parameters (activeDS.deviceHandle,
|
||||||
&activeDS.sane_param);
|
&activeDS.sane_param);
|
||||||
activeDS.sane_param_valid = TRUE;
|
activeDS.sane_param_valid = TRUE;
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
WARN("psane_get_parameters: %s\n", psane_strstatus (status));
|
WARN("sane_get_parameters: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -306,7 +289,7 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
/* access memory buffer */
|
/* access memory buffer */
|
||||||
if (pImageMemXfer->Memory.Length < activeDS.sane_param.bytes_per_line)
|
if (pImageMemXfer->Memory.Length < activeDS.sane_param.bytes_per_line)
|
||||||
{
|
{
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_BADVALUE;
|
activeDS.twCC = TWCC_BADVALUE;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -330,7 +313,7 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
while (consumed_len < (activeDS.sane_param.bytes_per_line*rows) &&
|
while (consumed_len < (activeDS.sane_param.bytes_per_line*rows) &&
|
||||||
status == SANE_STATUS_GOOD)
|
status == SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
status = psane_read (activeDS.deviceHandle, ptr,
|
status = sane_read (activeDS.deviceHandle, ptr,
|
||||||
(activeDS.sane_param.bytes_per_line*rows) - consumed_len ,
|
(activeDS.sane_param.bytes_per_line*rows) - consumed_len ,
|
||||||
&buff_len);
|
&buff_len);
|
||||||
consumed_len += buff_len;
|
consumed_len += buff_len;
|
||||||
|
@ -352,8 +335,8 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
if (status == SANE_STATUS_EOF)
|
if (status == SANE_STATUS_EOF)
|
||||||
{
|
{
|
||||||
ScanningDialogBox(activeDS.progressWnd, -1);
|
ScanningDialogBox(activeDS.progressWnd, -1);
|
||||||
TRACE("psane_read: %s\n", psane_strstatus (status));
|
TRACE("sane_read: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
twRC = TWRC_XFERDONE;
|
twRC = TWRC_XFERDONE;
|
||||||
}
|
}
|
||||||
|
@ -362,8 +345,8 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
else if (status != SANE_STATUS_EOF)
|
else if (status != SANE_STATUS_EOF)
|
||||||
{
|
{
|
||||||
ScanningDialogBox(activeDS.progressWnd, -1);
|
ScanningDialogBox(activeDS.progressWnd, -1);
|
||||||
WARN("psane_read: %s\n", psane_strstatus (status));
|
WARN("sane_read: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
twRC = TWRC_FAILURE;
|
twRC = TWRC_FAILURE;
|
||||||
|
@ -374,10 +357,8 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
|
||||||
LocalUnlock(pImageMemXfer->Memory.TheMem);
|
LocalUnlock(pImageMemXfer->Memory.TheMem);
|
||||||
|
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static SANE_Status read_one_line(SANE_Handle h, BYTE *line, int len)
|
static SANE_Status read_one_line(SANE_Handle h, BYTE *line, int len)
|
||||||
{
|
{
|
||||||
int read_len;
|
int read_len;
|
||||||
|
@ -386,7 +367,7 @@ static SANE_Status read_one_line(SANE_Handle h, BYTE *line, int len)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
read_len = 0;
|
read_len = 0;
|
||||||
status = psane_read (activeDS.deviceHandle, line, len, &read_len);
|
status = sane_read (activeDS.deviceHandle, line, len, &read_len);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -399,15 +380,11 @@ static SANE_Status read_one_line(SANE_Handle h, BYTE *line, int len)
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET */
|
/* DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET */
|
||||||
TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
TW_MEMREF pData)
|
TW_MEMREF pData)
|
||||||
{
|
{
|
||||||
#ifndef SONAME_LIBSANE
|
|
||||||
return TWRC_FAILURE;
|
|
||||||
#else
|
|
||||||
TW_UINT16 twRC = TWRC_SUCCESS;
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
||||||
pTW_UINT32 pHandle = (pTW_UINT32) pData;
|
pTW_UINT32 pHandle = (pTW_UINT32) pData;
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
@ -433,23 +410,23 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
/* Transfer an image from the source to the application */
|
/* Transfer an image from the source to the application */
|
||||||
if (! activeDS.sane_started)
|
if (! activeDS.sane_started)
|
||||||
{
|
{
|
||||||
status = psane_start (activeDS.deviceHandle);
|
status = sane_start (activeDS.deviceHandle);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
WARN("psane_start: %s\n", psane_strstatus (status));
|
WARN("sane_start: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
activeDS.sane_started = TRUE;
|
activeDS.sane_started = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
status = sane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
|
||||||
activeDS.sane_param_valid = TRUE;
|
activeDS.sane_param_valid = TRUE;
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
WARN("psane_get_parameters: %s\n", psane_strstatus (status));
|
WARN("sane_get_parameters: %s\n", sane_strstatus (status));
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -464,7 +441,7 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("For NATIVE, we support only 1 bit monochrome and 8 bit Grayscale, not %d\n", activeDS.sane_param.depth);
|
FIXME("For NATIVE, we support only 1 bit monochrome and 8 bit Grayscale, not %d\n", activeDS.sane_param.depth);
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -473,7 +450,7 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
else if (activeDS.sane_param.format != SANE_FRAME_RGB)
|
else if (activeDS.sane_param.format != SANE_FRAME_RGB)
|
||||||
{
|
{
|
||||||
FIXME("For NATIVE, we support only GRAY and RGB, not %d\n", activeDS.sane_param.format);
|
FIXME("For NATIVE, we support only GRAY and RGB, not %d\n", activeDS.sane_param.format);
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
|
@ -493,7 +470,7 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
if (!header)
|
if (!header)
|
||||||
{
|
{
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_LOWMEMORY;
|
activeDS.twCC = TWCC_LOWMEMORY;
|
||||||
if (hDIB)
|
if (hDIB)
|
||||||
|
@ -550,15 +527,15 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD && status != SANE_STATUS_EOF)
|
if (status != SANE_STATUS_GOOD && status != SANE_STATUS_EOF)
|
||||||
{
|
{
|
||||||
WARN("psane_read: %s, reading line %d\n", psane_strstatus(status), i);
|
WARN("sane_read: %s, reading line %d\n", sane_strstatus(status), i);
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
activeDS.twCC = TWCC_OPERATIONERROR;
|
activeDS.twCC = TWCC_OPERATIONERROR;
|
||||||
GlobalFree(hDIB);
|
GlobalFree(hDIB);
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
psane_cancel (activeDS.deviceHandle);
|
sane_cancel (activeDS.deviceHandle);
|
||||||
activeDS.sane_started = FALSE;
|
activeDS.sane_started = FALSE;
|
||||||
*pHandle = (UINT_PTR)hDIB;
|
*pHandle = (UINT_PTR)hDIB;
|
||||||
twRC = TWRC_XFERDONE;
|
twRC = TWRC_XFERDONE;
|
||||||
|
@ -566,5 +543,4 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
|
||||||
activeDS.currentState = 7;
|
activeDS.currentState = 7;
|
||||||
}
|
}
|
||||||
return twRC;
|
return twRC;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "sane_i.h"
|
#include "sane_i.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
static SANE_Status sane_find_option(SANE_Handle h, const char *option_name,
|
static SANE_Status sane_find_option(SANE_Handle h, const char *option_name,
|
||||||
const SANE_Option_Descriptor **opt_p, int *optno, SANE_Value_Type type)
|
const SANE_Option_Descriptor **opt_p, int *optno, SANE_Value_Type type)
|
||||||
{
|
{
|
||||||
|
@ -34,17 +33,17 @@ static SANE_Status sane_find_option(SANE_Handle h, const char *option_name,
|
||||||
/* Debian, in 32_net_backend_standard_fix.dpatch,
|
/* Debian, in 32_net_backend_standard_fix.dpatch,
|
||||||
* forces a frontend (that's us) to reload options
|
* forces a frontend (that's us) to reload options
|
||||||
* manually by invoking get_option_descriptor. */
|
* manually by invoking get_option_descriptor. */
|
||||||
opt = psane_get_option_descriptor(h, 0);
|
opt = sane_get_option_descriptor(h, 0);
|
||||||
if (! opt)
|
if (! opt)
|
||||||
return SANE_STATUS_EOF;
|
return SANE_STATUS_EOF;
|
||||||
|
|
||||||
rc = psane_control_option(h, 0, SANE_ACTION_GET_VALUE, &optcount, NULL);
|
rc = sane_control_option(h, 0, SANE_ACTION_GET_VALUE, &optcount, NULL);
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
for (i = 1; i < optcount; i++)
|
for (i = 1; i < optcount; i++)
|
||||||
{
|
{
|
||||||
opt = psane_get_option_descriptor(h, i);
|
opt = sane_get_option_descriptor(h, i);
|
||||||
if (opt && (opt->name && strcmp(opt->name, option_name) == 0) &&
|
if (opt && (opt->name && strcmp(opt->name, option_name) == 0) &&
|
||||||
opt->type == type)
|
opt->type == type)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +65,7 @@ SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_GET_VALUE, val, NULL);
|
return sane_control_option(h, optno, SANE_ACTION_GET_VALUE, val, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status)
|
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status)
|
||||||
|
@ -79,7 +78,7 @@ SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
return sane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status)
|
SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status)
|
||||||
|
@ -92,7 +91,7 @@ SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bo
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_GET_VALUE, (void *) val, status);
|
return sane_control_option(h, optno, SANE_ACTION_GET_VALUE, (void *) val, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status)
|
SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status)
|
||||||
|
@ -105,7 +104,7 @@ SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bo
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
return sane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status)
|
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status)
|
||||||
|
@ -118,7 +117,7 @@ SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_F
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
return sane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) &val, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status)
|
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status)
|
||||||
|
@ -132,7 +131,7 @@ SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_Str
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (opt->size < len)
|
if (opt->size < len)
|
||||||
return psane_control_option(h, optno, SANE_ACTION_GET_VALUE, (void *) val, status);
|
return sane_control_option(h, optno, SANE_ACTION_GET_VALUE, (void *) val, status);
|
||||||
else
|
else
|
||||||
return SANE_STATUS_NO_MEM;
|
return SANE_STATUS_NO_MEM;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +147,7 @@ SANE_Status sane_option_set_str(SANE_Handle h, const char *option_name, SANE_Str
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return psane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) val, status);
|
return sane_control_option(h, optno, SANE_ACTION_SET_VALUE, (void *) val, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant)
|
SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant)
|
||||||
|
@ -184,7 +183,7 @@ SANE_Status sane_option_probe_mode(SANE_Handle h, SANE_String_Const **choices, c
|
||||||
*choices = (SANE_String_Const *) opt->constraint.string_list;
|
*choices = (SANE_String_Const *) opt->constraint.string_list;
|
||||||
|
|
||||||
if (opt->size < current_size)
|
if (opt->size < current_size)
|
||||||
return psane_control_option(h, optno, SANE_ACTION_GET_VALUE, current, NULL);
|
return sane_control_option(h, optno, SANE_ACTION_GET_VALUE, current, NULL);
|
||||||
else
|
else
|
||||||
return SANE_STATUS_NO_MEM;
|
return SANE_STATUS_NO_MEM;
|
||||||
|
|
||||||
|
@ -211,7 +210,7 @@ SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name,
|
||||||
*quant = opt->constraint.range->quant;
|
*quant = opt->constraint.range->quant;
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
rc = psane_control_option(h, optno, SANE_ACTION_GET_VALUE, val, NULL);
|
rc = sane_control_option(h, optno, SANE_ACTION_GET_VALUE, val, NULL);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -261,4 +260,3 @@ BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -25,35 +25,14 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
#include <sane/sane.h>
|
||||||
# include <sane/sane.h>
|
#include <sane/saneopts.h>
|
||||||
# include <sane/saneopts.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "twain.h"
|
#include "twain.h"
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
#define MAKE_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN;
|
|
||||||
MAKE_FUNCPTR(sane_init)
|
|
||||||
MAKE_FUNCPTR(sane_exit)
|
|
||||||
MAKE_FUNCPTR(sane_get_devices)
|
|
||||||
MAKE_FUNCPTR(sane_open)
|
|
||||||
MAKE_FUNCPTR(sane_close)
|
|
||||||
MAKE_FUNCPTR(sane_get_option_descriptor)
|
|
||||||
MAKE_FUNCPTR(sane_control_option)
|
|
||||||
MAKE_FUNCPTR(sane_get_parameters)
|
|
||||||
MAKE_FUNCPTR(sane_start)
|
|
||||||
MAKE_FUNCPTR(sane_read)
|
|
||||||
MAKE_FUNCPTR(sane_cancel)
|
|
||||||
MAKE_FUNCPTR(sane_set_io_mode)
|
|
||||||
MAKE_FUNCPTR(sane_get_select_fd)
|
|
||||||
MAKE_FUNCPTR(sane_strstatus)
|
|
||||||
#undef MAKE_FUNCPTR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern HINSTANCE SANE_instance DECLSPEC_HIDDEN;
|
extern HINSTANCE SANE_instance DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
|
#define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
|
||||||
|
@ -68,14 +47,14 @@ struct tagActiveDS
|
||||||
TW_IDENTITY appIdentity; /* identity of the app */
|
TW_IDENTITY appIdentity; /* identity of the app */
|
||||||
HWND hwndOwner; /* window handle of the app */
|
HWND hwndOwner; /* window handle of the app */
|
||||||
HWND progressWnd; /* window handle of the scanning window */
|
HWND progressWnd; /* window handle of the scanning window */
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
SANE_Handle deviceHandle; /* device handle */
|
SANE_Handle deviceHandle; /* device handle */
|
||||||
SANE_Parameters sane_param; /* parameters about the image
|
SANE_Parameters sane_param; /* parameters about the image
|
||||||
transferred */
|
transferred */
|
||||||
BOOL sane_param_valid; /* true if valid sane_param*/
|
BOOL sane_param_valid; /* true if valid sane_param*/
|
||||||
BOOL sane_started; /* If sane_start has been called */
|
BOOL sane_started; /* If sane_start has been called */
|
||||||
INT deviceIndex; /* index of the current device */
|
INT deviceIndex; /* index of the current device */
|
||||||
#endif
|
|
||||||
/* Capabilities */
|
/* Capabilities */
|
||||||
TW_UINT16 capXferMech; /* ICAP_XFERMECH */
|
TW_UINT16 capXferMech; /* ICAP_XFERMECH */
|
||||||
BOOL PixelTypeSet;
|
BOOL PixelTypeSet;
|
||||||
|
@ -227,7 +206,6 @@ BOOL DoScannerUI(void) DECLSPEC_HIDDEN;
|
||||||
HWND ScanningDialogBox(HWND dialog, LONG progress) DECLSPEC_HIDDEN;
|
HWND ScanningDialogBox(HWND dialog, LONG progress) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Option functions */
|
/* Option functions */
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val) DECLSPEC_HIDDEN;
|
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val) DECLSPEC_HIDDEN;
|
||||||
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status) DECLSPEC_HIDDEN;
|
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status) DECLSPEC_HIDDEN;
|
||||||
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status) DECLSPEC_HIDDEN;
|
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status) DECLSPEC_HIDDEN;
|
||||||
|
@ -241,7 +219,5 @@ SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bo
|
||||||
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status) DECLSPEC_HIDDEN;
|
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status) DECLSPEC_HIDDEN;
|
||||||
TW_UINT16 sane_status_to_twcc(SANE_Status rc) DECLSPEC_HIDDEN;
|
TW_UINT16 sane_status_to_twcc(SANE_Status rc) DECLSPEC_HIDDEN;
|
||||||
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype) DECLSPEC_HIDDEN;
|
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype) DECLSPEC_HIDDEN;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,72 +32,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
||||||
struct tagActiveDS activeDS;
|
struct tagActiveDS activeDS;
|
||||||
|
|
||||||
DSMENTRYPROC SANE_dsmentry;
|
DSMENTRYPROC SANE_dsmentry;
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
#define MAKE_FUNCPTR(f) typeof(f) * p##f;
|
|
||||||
MAKE_FUNCPTR(sane_init)
|
|
||||||
MAKE_FUNCPTR(sane_exit)
|
|
||||||
MAKE_FUNCPTR(sane_get_devices)
|
|
||||||
MAKE_FUNCPTR(sane_open)
|
|
||||||
MAKE_FUNCPTR(sane_close)
|
|
||||||
MAKE_FUNCPTR(sane_get_option_descriptor)
|
|
||||||
MAKE_FUNCPTR(sane_control_option)
|
|
||||||
MAKE_FUNCPTR(sane_get_parameters)
|
|
||||||
MAKE_FUNCPTR(sane_start)
|
|
||||||
MAKE_FUNCPTR(sane_read)
|
|
||||||
MAKE_FUNCPTR(sane_cancel)
|
|
||||||
MAKE_FUNCPTR(sane_set_io_mode)
|
|
||||||
MAKE_FUNCPTR(sane_get_select_fd)
|
|
||||||
MAKE_FUNCPTR(sane_strstatus)
|
|
||||||
#undef MAKE_FUNCPTR
|
|
||||||
|
|
||||||
HINSTANCE SANE_instance;
|
HINSTANCE SANE_instance;
|
||||||
|
|
||||||
static void *libsane_handle;
|
|
||||||
|
|
||||||
static void close_libsane(void *h)
|
|
||||||
{
|
|
||||||
if (h)
|
|
||||||
dlclose(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *open_libsane(void)
|
|
||||||
{
|
|
||||||
void *h;
|
|
||||||
|
|
||||||
h = dlopen(SONAME_LIBSANE, RTLD_GLOBAL | RTLD_NOW);
|
|
||||||
if (!h)
|
|
||||||
{
|
|
||||||
WARN("failed to load %s; %s\n", SONAME_LIBSANE, dlerror());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LOAD_FUNCPTR(f) \
|
|
||||||
if((p##f = dlsym(h, #f)) == NULL) { \
|
|
||||||
close_libsane(h); \
|
|
||||||
ERR("Could not dlsym %s\n", #f); \
|
|
||||||
return NULL; \
|
|
||||||
}
|
|
||||||
|
|
||||||
LOAD_FUNCPTR(sane_init)
|
|
||||||
LOAD_FUNCPTR(sane_exit)
|
|
||||||
LOAD_FUNCPTR(sane_get_devices)
|
|
||||||
LOAD_FUNCPTR(sane_open)
|
|
||||||
LOAD_FUNCPTR(sane_close)
|
|
||||||
LOAD_FUNCPTR(sane_get_option_descriptor)
|
|
||||||
LOAD_FUNCPTR(sane_control_option)
|
|
||||||
LOAD_FUNCPTR(sane_get_parameters)
|
|
||||||
LOAD_FUNCPTR(sane_start)
|
|
||||||
LOAD_FUNCPTR(sane_read)
|
|
||||||
LOAD_FUNCPTR(sane_cancel)
|
|
||||||
LOAD_FUNCPTR(sane_set_io_mode)
|
|
||||||
LOAD_FUNCPTR(sane_get_select_fd)
|
|
||||||
LOAD_FUNCPTR(sane_strstatus)
|
|
||||||
#undef LOAD_FUNCPTR
|
|
||||||
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
|
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
|
||||||
|
@ -107,11 +43,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
case DLL_PROCESS_ATTACH: {
|
case DLL_PROCESS_ATTACH: {
|
||||||
SANE_Int version_code;
|
SANE_Int version_code;
|
||||||
|
|
||||||
libsane_handle = open_libsane();
|
sane_init (&version_code, NULL);
|
||||||
if (! libsane_handle)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
psane_init (&version_code, NULL);
|
|
||||||
SANE_instance = hinstDLL;
|
SANE_instance = hinstDLL;
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
break;
|
break;
|
||||||
|
@ -119,8 +51,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
if (lpvReserved) break;
|
if (lpvReserved) break;
|
||||||
TRACE("calling sane_exit()\n");
|
TRACE("calling sane_exit()\n");
|
||||||
psane_exit ();
|
sane_exit ();
|
||||||
close_libsane(libsane_handle);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +60,6 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
static TW_UINT16 SANE_GetIdentity( pTW_IDENTITY, pTW_IDENTITY);
|
static TW_UINT16 SANE_GetIdentity( pTW_IDENTITY, pTW_IDENTITY);
|
||||||
static TW_UINT16 SANE_OpenDS( pTW_IDENTITY, pTW_IDENTITY);
|
static TW_UINT16 SANE_OpenDS( pTW_IDENTITY, pTW_IDENTITY);
|
||||||
|
|
||||||
#endif /* SONAME_LIBSANE */
|
|
||||||
|
|
||||||
static TW_UINT16 SANE_SetEntryPoint (pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
static TW_UINT16 SANE_SetEntryPoint (pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
||||||
|
|
||||||
static TW_UINT16 SANE_SourceControlHandler (
|
static TW_UINT16 SANE_SourceControlHandler (
|
||||||
|
@ -148,28 +76,13 @@ static TW_UINT16 SANE_SourceControlHandler (
|
||||||
switch (MSG)
|
switch (MSG)
|
||||||
{
|
{
|
||||||
case MSG_CLOSEDS:
|
case MSG_CLOSEDS:
|
||||||
#ifdef SONAME_LIBSANE
|
sane_close (activeDS.deviceHandle);
|
||||||
psane_close (activeDS.deviceHandle);
|
|
||||||
#else
|
|
||||||
twRC = TWRC_FAILURE;
|
|
||||||
activeDS.twCC = TWCC_CAPUNSUPPORTED;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case MSG_OPENDS:
|
case MSG_OPENDS:
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
twRC = SANE_OpenDS( pOrigin, (pTW_IDENTITY)pData);
|
twRC = SANE_OpenDS( pOrigin, (pTW_IDENTITY)pData);
|
||||||
#else
|
|
||||||
twRC = TWRC_FAILURE;
|
|
||||||
activeDS.twCC = TWCC_CAPUNSUPPORTED;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case MSG_GET:
|
case MSG_GET:
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
twRC = SANE_GetIdentity( pOrigin, (pTW_IDENTITY)pData);
|
twRC = SANE_GetIdentity( pOrigin, (pTW_IDENTITY)pData);
|
||||||
#else
|
|
||||||
twRC = TWRC_FAILURE;
|
|
||||||
activeDS.twCC = TWCC_CAPUNSUPPORTED;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -427,7 +340,6 @@ TW_UINT16 SANE_SetEntryPoint (pTW_IDENTITY pOrigin, TW_MEMREF pData)
|
||||||
return TWRC_SUCCESS;
|
return TWRC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
/* Sane returns device names that are longer than the 32 bytes allowed
|
/* Sane returns device names that are longer than the 32 bytes allowed
|
||||||
by TWAIN. However, it colon separates them, and the last bit is
|
by TWAIN. However, it colon separates them, and the last bit is
|
||||||
the most interesting. So we use the last bit, and add a signature
|
the most interesting. So we use the last bit, and add a signature
|
||||||
|
@ -466,7 +378,7 @@ static void
|
||||||
detect_sane_devices(void) {
|
detect_sane_devices(void) {
|
||||||
if (sane_devlist && sane_devlist[0]) return;
|
if (sane_devlist && sane_devlist[0]) return;
|
||||||
TRACE("detecting sane...\n");
|
TRACE("detecting sane...\n");
|
||||||
if (psane_get_devices (&sane_devlist, SANE_FALSE) != SANE_STATUS_GOOD)
|
if (sane_get_devices (&sane_devlist, SANE_FALSE) != SANE_STATUS_GOOD)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +450,7 @@ static TW_UINT16 SANE_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) {
|
||||||
WARN("Scanner not found.\n");
|
WARN("Scanner not found.\n");
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
status = psane_open(sane_devlist[i]->name,&activeDS.deviceHandle);
|
status = sane_open(sane_devlist[i]->name,&activeDS.deviceHandle);
|
||||||
if (status == SANE_STATUS_GOOD) {
|
if (status == SANE_STATUS_GOOD) {
|
||||||
activeDS.twCC = SANE_SaneSetDefaults();
|
activeDS.twCC = SANE_SaneSetDefaults();
|
||||||
if (activeDS.twCC == TWCC_SUCCESS) {
|
if (activeDS.twCC == TWCC_SUCCESS) {
|
||||||
|
@ -548,10 +460,9 @@ static TW_UINT16 SANE_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) {
|
||||||
return TWRC_SUCCESS;
|
return TWRC_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
psane_close(activeDS.deviceHandle);
|
sane_close(activeDS.deviceHandle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERR("sane_open(%s): %s\n", sane_devlist[i]->name, psane_strstatus (status));
|
ERR("sane_open(%s): %s\n", sane_devlist[i]->name, sane_strstatus (status));
|
||||||
return TWRC_FAILURE;
|
return TWRC_FAILURE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
#ifdef SONAME_LIBSANE
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
||||||
|
|
||||||
#define ID_BASE 0x100
|
#define ID_BASE 0x100
|
||||||
|
@ -173,7 +171,7 @@ static int create_item(HDC hdc, const SANE_Option_Descriptor *opt,
|
||||||
{
|
{
|
||||||
SANE_Int i;
|
SANE_Int i;
|
||||||
|
|
||||||
psane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
sane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
||||||
SANE_ACTION_GET_VALUE, &i,NULL);
|
SANE_ACTION_GET_VALUE, &i,NULL);
|
||||||
|
|
||||||
sprintf(buffer,"%i",i);
|
sprintf(buffer,"%i",i);
|
||||||
|
@ -209,7 +207,7 @@ static int create_item(HDC hdc, const SANE_Option_Descriptor *opt,
|
||||||
|
|
||||||
i = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(SANE_Word));
|
i = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(SANE_Word));
|
||||||
|
|
||||||
psane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
sane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
||||||
SANE_ACTION_GET_VALUE, i, NULL);
|
SANE_ACTION_GET_VALUE, i, NULL);
|
||||||
|
|
||||||
dd = SANE_UNFIX(*i);
|
dd = SANE_UNFIX(*i);
|
||||||
|
@ -253,7 +251,7 @@ static int create_item(HDC hdc, const SANE_Option_Descriptor *opt,
|
||||||
}
|
}
|
||||||
leading_len += create_leading_static(hdc, opt->title, &lead_static, y,
|
leading_len += create_leading_static(hdc, opt->title, &lead_static, y,
|
||||||
id+ID_STATIC_BASE);
|
id+ID_STATIC_BASE);
|
||||||
psane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
sane_control_option(activeDS.deviceHandle, id-ID_BASE,
|
||||||
SANE_ACTION_GET_VALUE, buffer,NULL);
|
SANE_ACTION_GET_VALUE, buffer,NULL);
|
||||||
|
|
||||||
title = buffer;
|
title = buffer;
|
||||||
|
@ -391,7 +389,7 @@ static LPDLGTEMPLATEW create_options_page(HDC hdc, int *from_index,
|
||||||
int count;
|
int count;
|
||||||
int hold_for_group = 0;
|
int hold_for_group = 0;
|
||||||
|
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, i);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, i);
|
||||||
if (!opt)
|
if (!opt)
|
||||||
continue;
|
continue;
|
||||||
if (opt->type == SANE_TYPE_GROUP && split_tabs)
|
if (opt->type == SANE_TYPE_GROUP && split_tabs)
|
||||||
|
@ -529,7 +527,7 @@ BOOL DoScannerUI(void)
|
||||||
hdc = GetDC(0);
|
hdc = GetDC(0);
|
||||||
|
|
||||||
memset(psp,0,sizeof(psp));
|
memset(psp,0,sizeof(psp));
|
||||||
rc = psane_control_option(activeDS.deviceHandle, 0, SANE_ACTION_GET_VALUE,
|
rc = sane_control_option(activeDS.deviceHandle, 0, SANE_ACTION_GET_VALUE,
|
||||||
&optcount, NULL);
|
&optcount, NULL);
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -542,7 +540,7 @@ BOOL DoScannerUI(void)
|
||||||
const SANE_Option_Descriptor *opt;
|
const SANE_Option_Descriptor *opt;
|
||||||
psp[page_count].u.pResource = create_options_page(hdc, &index,
|
psp[page_count].u.pResource = create_options_page(hdc, &index,
|
||||||
optcount, TRUE);
|
optcount, TRUE);
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, index);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, index);
|
||||||
|
|
||||||
if (opt->type == SANE_TYPE_GROUP)
|
if (opt->type == SANE_TYPE_GROUP)
|
||||||
{
|
{
|
||||||
|
@ -661,7 +659,7 @@ static BOOL UpdateSaneScrollOption(
|
||||||
else
|
else
|
||||||
si = position;
|
si = position;
|
||||||
|
|
||||||
rc = psane_control_option (activeDS.deviceHandle,index,
|
rc = sane_control_option (activeDS.deviceHandle,index,
|
||||||
SANE_ACTION_SET_VALUE, &si, &result);
|
SANE_ACTION_SET_VALUE, &si, &result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -681,7 +679,7 @@ static BOOL UpdateSaneScrollOption(
|
||||||
|
|
||||||
*sf = SANE_FIX(dd);
|
*sf = SANE_FIX(dd);
|
||||||
|
|
||||||
rc = psane_control_option (activeDS.deviceHandle,index,
|
rc = sane_control_option (activeDS.deviceHandle,index,
|
||||||
SANE_ACTION_SET_VALUE, sf, &result);
|
SANE_ACTION_SET_VALUE, sf, &result);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,sf);
|
HeapFree(GetProcessHeap(),0,sf);
|
||||||
|
@ -704,7 +702,7 @@ static BOOL UpdateSaneBoolOption(int index, BOOL position)
|
||||||
|
|
||||||
si = position;
|
si = position;
|
||||||
|
|
||||||
rc = psane_control_option (activeDS.deviceHandle,index,
|
rc = sane_control_option (activeDS.deviceHandle,index,
|
||||||
SANE_ACTION_SET_VALUE, &si, &result);
|
SANE_ACTION_SET_VALUE, &si, &result);
|
||||||
|
|
||||||
if(rc == SANE_STATUS_GOOD)
|
if(rc == SANE_STATUS_GOOD)
|
||||||
|
@ -721,7 +719,7 @@ static BOOL UpdateSaneIntOption(int index, SANE_Int value)
|
||||||
SANE_Status rc = SANE_STATUS_GOOD;
|
SANE_Status rc = SANE_STATUS_GOOD;
|
||||||
SANE_Int result = 0;
|
SANE_Int result = 0;
|
||||||
|
|
||||||
rc = psane_control_option (activeDS.deviceHandle,index,
|
rc = sane_control_option (activeDS.deviceHandle,index,
|
||||||
SANE_ACTION_SET_VALUE, &value, &result);
|
SANE_ACTION_SET_VALUE, &value, &result);
|
||||||
|
|
||||||
if(rc == SANE_STATUS_GOOD)
|
if(rc == SANE_STATUS_GOOD)
|
||||||
|
@ -738,7 +736,7 @@ static BOOL UpdateSaneStringOption(int index, SANE_String value)
|
||||||
SANE_Status rc = SANE_STATUS_GOOD;
|
SANE_Status rc = SANE_STATUS_GOOD;
|
||||||
SANE_Int result = 0;
|
SANE_Int result = 0;
|
||||||
|
|
||||||
rc = psane_control_option (activeDS.deviceHandle,index,
|
rc = sane_control_option (activeDS.deviceHandle,index,
|
||||||
SANE_ACTION_SET_VALUE, value, &result);
|
SANE_ACTION_SET_VALUE, value, &result);
|
||||||
|
|
||||||
if(rc == SANE_STATUS_GOOD)
|
if(rc == SANE_STATUS_GOOD)
|
||||||
|
@ -757,7 +755,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
HWND control;
|
HWND control;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rc = psane_control_option(activeDS.deviceHandle, 0, SANE_ACTION_GET_VALUE,
|
rc = sane_control_option(activeDS.deviceHandle, 0, SANE_ACTION_GET_VALUE,
|
||||||
&optcount, NULL);
|
&optcount, NULL);
|
||||||
if (rc != SANE_STATUS_GOOD)
|
if (rc != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -774,7 +772,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
if (!control)
|
if (!control)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, i);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, i);
|
||||||
|
|
||||||
TRACE("%i %s %i %i\n",i,opt->title,opt->type,opt->constraint_type);
|
TRACE("%i %s %i %i\n",i,opt->title,opt->type,opt->constraint_type);
|
||||||
|
|
||||||
|
@ -796,13 +794,13 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
(LPARAM)opt->constraint.string_list[j]);
|
(LPARAM)opt->constraint.string_list[j]);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
psane_control_option(activeDS.deviceHandle, i, SANE_ACTION_GET_VALUE, buffer,NULL);
|
sane_control_option(activeDS.deviceHandle, i, SANE_ACTION_GET_VALUE, buffer,NULL);
|
||||||
SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
|
SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
|
||||||
}
|
}
|
||||||
else if (opt->type == SANE_TYPE_BOOL)
|
else if (opt->type == SANE_TYPE_BOOL)
|
||||||
{
|
{
|
||||||
SANE_Bool b;
|
SANE_Bool b;
|
||||||
psane_control_option(activeDS.deviceHandle, i,
|
sane_control_option(activeDS.deviceHandle, i,
|
||||||
SANE_ACTION_GET_VALUE, &b, NULL);
|
SANE_ACTION_GET_VALUE, &b, NULL);
|
||||||
if (b)
|
if (b)
|
||||||
SendMessageA(control,BM_SETCHECK,BST_CHECKED,0);
|
SendMessageA(control,BM_SETCHECK,BST_CHECKED,0);
|
||||||
|
@ -819,7 +817,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
sprintf(buffer, "%d", opt->constraint.word_list[j]);
|
sprintf(buffer, "%d", opt->constraint.word_list[j]);
|
||||||
SendMessageA(control, CB_ADDSTRING, 0, (LPARAM)buffer);
|
SendMessageA(control, CB_ADDSTRING, 0, (LPARAM)buffer);
|
||||||
}
|
}
|
||||||
psane_control_option(activeDS.deviceHandle, i, SANE_ACTION_GET_VALUE, &val, NULL);
|
sane_control_option(activeDS.deviceHandle, i, SANE_ACTION_GET_VALUE, &val, NULL);
|
||||||
sprintf(buffer, "%d", val);
|
sprintf(buffer, "%d", val);
|
||||||
SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
|
SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
|
||||||
}
|
}
|
||||||
|
@ -840,7 +838,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
|
|
||||||
SendMessageA(control,SBM_SETRANGE,min,max);
|
SendMessageA(control,SBM_SETRANGE,min,max);
|
||||||
|
|
||||||
psane_control_option(activeDS.deviceHandle, i,
|
sane_control_option(activeDS.deviceHandle, i,
|
||||||
SANE_ACTION_GET_VALUE, &si,NULL);
|
SANE_ACTION_GET_VALUE, &si,NULL);
|
||||||
if (opt->constraint.range->quant)
|
if (opt->constraint.range->quant)
|
||||||
si = si / opt->constraint.range->quant;
|
si = si / opt->constraint.range->quant;
|
||||||
|
@ -876,7 +874,7 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
|
|
||||||
|
|
||||||
sf = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(SANE_Word));
|
sf = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(SANE_Word));
|
||||||
psane_control_option(activeDS.deviceHandle, i,
|
sane_control_option(activeDS.deviceHandle, i,
|
||||||
SANE_ACTION_GET_VALUE, sf,NULL);
|
SANE_ACTION_GET_VALUE, sf,NULL);
|
||||||
|
|
||||||
dd = SANE_UNFIX(*sf);
|
dd = SANE_UNFIX(*sf);
|
||||||
|
@ -912,7 +910,7 @@ static INT_PTR ProcessScroll(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, index);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, index);
|
||||||
|
|
||||||
if (!opt)
|
if (!opt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -967,7 +965,7 @@ static void ButtonClicked(HWND hwnd, INT id, HWND control)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, index);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, index);
|
||||||
|
|
||||||
if (!opt)
|
if (!opt)
|
||||||
return;
|
return;
|
||||||
|
@ -992,7 +990,7 @@ static void ComboChanged(HWND hwnd, INT id, HWND control)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opt = psane_get_option_descriptor(activeDS.deviceHandle, index);
|
opt = sane_get_option_descriptor(activeDS.deviceHandle, index);
|
||||||
|
|
||||||
if (!opt)
|
if (!opt)
|
||||||
return;
|
return;
|
||||||
|
@ -1094,12 +1092,3 @@ HWND ScanningDialogBox(HWND dialog, LONG progress)
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* SONAME_LIBSANE */
|
|
||||||
|
|
||||||
BOOL DoScannerUI(void)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SONAME_LIBSANE */
|
|
||||||
|
|
|
@ -937,9 +937,6 @@
|
||||||
/* Define to the soname of the libOSMesa library. */
|
/* Define to the soname of the libOSMesa library. */
|
||||||
#undef SONAME_LIBOSMESA
|
#undef SONAME_LIBOSMESA
|
||||||
|
|
||||||
/* Define to the soname of the libsane library. */
|
|
||||||
#undef SONAME_LIBSANE
|
|
||||||
|
|
||||||
/* Define to the soname of the libSDL2 library. */
|
/* Define to the soname of the libSDL2 library. */
|
||||||
#undef SONAME_LIBSDL2
|
#undef SONAME_LIBSDL2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue