2006-05-08 18:05:42 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2000 Corel Corporation
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-05-08 18:05:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TWAIN32_H
|
|
|
|
#define _TWAIN32_H
|
|
|
|
|
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h first
|
|
|
|
#endif
|
|
|
|
|
2007-07-02 17:42:13 +00:00
|
|
|
#ifdef SONAME_LIBSANE
|
2006-05-08 18:05:42 +00:00
|
|
|
# include <sane/sane.h>
|
2009-02-26 02:58:42 +00:00
|
|
|
# include <sane/saneopts.h>
|
2007-03-14 18:10:03 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
|
2006-05-08 18:05:42 +00:00
|
|
|
#endif
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2009-02-09 19:02:28 +00:00
|
|
|
#include "winuser.h"
|
2006-05-08 18:05:42 +00:00
|
|
|
#include "twain.h"
|
|
|
|
|
|
|
|
extern HINSTANCE SANE_instance;
|
|
|
|
|
2009-02-23 22:25:26 +00:00
|
|
|
#define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
|
|
|
|
|
2006-05-08 18:05:42 +00:00
|
|
|
/* internal information about an active data source */
|
|
|
|
struct tagActiveDS
|
|
|
|
{
|
|
|
|
struct tagActiveDS *next; /* next active DS */
|
|
|
|
TW_IDENTITY identity; /* identity */
|
|
|
|
TW_UINT16 currentState; /* current state */
|
2009-02-09 19:02:28 +00:00
|
|
|
UINT windowMessage; /* message to use to send status */
|
2006-05-08 18:05:42 +00:00
|
|
|
TW_UINT16 twCC; /* condition code */
|
|
|
|
HWND hwndOwner; /* window handle of the app */
|
|
|
|
HWND progressWnd; /* window handle of the scanning window */
|
2007-07-02 17:42:13 +00:00
|
|
|
#ifdef SONAME_LIBSANE
|
2006-05-08 18:05:42 +00:00
|
|
|
SANE_Handle deviceHandle; /* device handle */
|
|
|
|
SANE_Parameters sane_param; /* parameters about the image
|
|
|
|
transferred */
|
|
|
|
BOOL sane_param_valid; /* true if valid sane_param*/
|
2009-03-05 19:25:58 +00:00
|
|
|
BOOL sane_started; /* If sane_start has been called */
|
2006-05-08 18:05:42 +00:00
|
|
|
INT deviceIndex; /* index of the current device */
|
|
|
|
#endif
|
2008-04-11 02:17:14 +00:00
|
|
|
/* Capabilities */
|
2006-05-08 18:05:42 +00:00
|
|
|
TW_UINT16 capXferMech; /* ICAP_XFERMECH */
|
2009-02-26 02:58:42 +00:00
|
|
|
BOOL PixelTypeSet;
|
|
|
|
TW_UINT16 defaultPixelType; /* ICAP_PIXELTYPE */
|
2009-02-23 22:25:26 +00:00
|
|
|
BOOL XResolutionSet;
|
|
|
|
TW_FIX32 defaultXResolution;
|
|
|
|
BOOL YResolutionSet;
|
|
|
|
TW_FIX32 defaultYResolution;
|
2006-05-08 18:05:42 +00:00
|
|
|
} activeDS;
|
|
|
|
|
|
|
|
/* Helper functions */
|
|
|
|
extern TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action);
|
2009-03-05 19:15:13 +00:00
|
|
|
extern TW_UINT16 SANE_SaneSetDefaults (void);
|
2006-05-08 18:05:42 +00:00
|
|
|
|
|
|
|
/* Implementation of operation triplets
|
|
|
|
* From Application to Source (Control Information) */
|
|
|
|
TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CapabilityGetCurrent
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CapabilityGetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CapabilityQuerySupport
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CapabilityReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CapabilitySet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CustomDSDataGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CustomDSDataSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_AutomaticCaptureDirectory
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ChangeDirectory
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemCopy
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_CreateDirectory
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemDelete
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FormatMedia
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemGetClose
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemGetFirstFile
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemGetInfo
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemGetNextFile
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_FileSystemRename
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ProcessEvent
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_PassThrough
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_PendingXfersEndXfer
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_PendingXfersGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_PendingXfersReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_PendingXfersStopFeeder
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXferGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXferGetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXferReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXferSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXfer2Get
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXfer2GetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXfer2Reset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupFileXfer2Set
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_SetupMemXferGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_GetDSStatus
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_DisableDSUserInterface
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_EnableDSUserInterface
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_EnableDSUIOnly
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_XferGroupGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_XferGroupSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
|
|
|
|
/* Implementation of operation triplets
|
|
|
|
* From Application to Source (Image Information) */
|
|
|
|
TW_UINT16 SANE_CIEColorGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ExtImageInfoGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_GrayResponseReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_GrayResponseSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageFileXferGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageInfoGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageLayoutGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageLayoutGetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageLayoutReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageLayoutSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageMemXferGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_ImageNativeXferGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_JPEGCompressionGet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_JPEGCompressionGetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_JPEGCompressionReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_JPEGCompressionSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_Palette8Get
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_Palette8GetDefault
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_Palette8Reset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_Palette8Set
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_RGBResponseReset
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
TW_UINT16 SANE_RGBResponseSet
|
|
|
|
(pTW_IDENTITY pOrigin, TW_MEMREF pData);
|
|
|
|
|
|
|
|
/* UI function */
|
|
|
|
BOOL DoScannerUI(void);
|
|
|
|
HWND ScanningDialogBox(HWND dialog, LONG progress);
|
|
|
|
|
2009-02-13 19:14:30 +00:00
|
|
|
/* Option functions */
|
|
|
|
#ifdef SONAME_LIBSANE
|
|
|
|
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val);
|
2009-02-23 22:25:26 +00:00
|
|
|
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status);
|
2009-03-05 19:15:20 +00:00
|
|
|
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status);
|
2009-02-26 02:58:42 +00:00
|
|
|
SANE_Status sane_option_set_str(SANE_Handle h, const char *option_name, SANE_String val, SANE_Int *status);
|
2009-02-23 22:25:26 +00:00
|
|
|
SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant);
|
2009-02-26 02:58:42 +00:00
|
|
|
SANE_Status sane_option_probe_mode(SANE_Handle h, SANE_String_Const **choices, char *current, int current_size);
|
2009-03-05 19:15:06 +00:00
|
|
|
SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name, SANE_Fixed *val,
|
|
|
|
SANE_Unit *unit, SANE_Fixed *min, SANE_Fixed *max, SANE_Fixed *quant);
|
2009-03-05 19:15:13 +00:00
|
|
|
SANE_Status sane_option_get_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);
|
2009-03-06 17:52:33 +00:00
|
|
|
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status);
|
2009-03-10 20:48:18 +00:00
|
|
|
TW_UINT16 sane_status_to_twcc(SANE_Status rc);
|
|
|
|
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype);
|
2009-02-13 19:14:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-05-08 18:05:42 +00:00
|
|
|
#endif
|