2 * Copyright 2000 Corel Corporation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_CONFIG_H
23 # error You must include config.h first
27 # include <sane/sane.h>
29 #define MAKE_FUNCPTR(f) typeof(f) * p##f;
30 MAKE_FUNCPTR(sane_init
)
31 MAKE_FUNCPTR(sane_exit
)
32 MAKE_FUNCPTR(sane_get_devices
)
33 MAKE_FUNCPTR(sane_open
)
34 MAKE_FUNCPTR(sane_close
)
35 MAKE_FUNCPTR(sane_get_option_descriptor
)
36 MAKE_FUNCPTR(sane_control_option
)
37 MAKE_FUNCPTR(sane_get_parameters
)
38 MAKE_FUNCPTR(sane_start
)
39 MAKE_FUNCPTR(sane_read
)
40 MAKE_FUNCPTR(sane_cancel
)
41 MAKE_FUNCPTR(sane_set_io_mode
)
42 MAKE_FUNCPTR(sane_get_select_fd
)
43 MAKE_FUNCPTR(sane_strstatus
)
53 extern HINSTANCE SANE_instance
;
55 /* internal information about an active data source */
58 struct tagActiveDS
*next
; /* next active DS */
59 TW_IDENTITY identity
; /* identity */
60 TW_UINT16 currentState
; /* current state */
61 TW_EVENT pendingEvent
; /* pending event to be sent to
63 TW_UINT16 twCC
; /* condition code */
64 HWND hwndOwner
; /* window handle of the app */
65 HWND progressWnd
; /* window handle of the scanning window */
67 SANE_Handle deviceHandle
; /* device handle */
68 SANE_Parameters sane_param
; /* parameters about the image
70 BOOL sane_param_valid
; /* true if valid sane_param*/
71 INT deviceIndex
; /* index of the current device */
74 TW_UINT16 capXferMech
; /* ICAP_XFERMECH */
77 /* Helper functions */
78 extern TW_UINT16
SANE_SaneCapability (pTW_CAPABILITY pCapability
, TW_UINT16 action
);
81 extern TW_UINT16
SANE_ControlGroupHandler (
82 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
83 extern TW_UINT16
SANE_ImageGroupHandler (
84 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
85 extern TW_UINT16
SANE_SourceManagerHandler (
86 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
88 /* Implementation of operation triplets
89 * From Application to Source (Control Information) */
90 TW_UINT16
SANE_CapabilityGet (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
91 TW_UINT16 SANE_CapabilityGetCurrent
92 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
93 TW_UINT16 SANE_CapabilityGetDefault
94 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
95 TW_UINT16 SANE_CapabilityQuerySupport
96 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
97 TW_UINT16 SANE_CapabilityReset
98 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
99 TW_UINT16 SANE_CapabilitySet
100 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
101 TW_UINT16 SANE_CustomDSDataGet
102 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
103 TW_UINT16 SANE_CustomDSDataSet
104 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
105 TW_UINT16 SANE_AutomaticCaptureDirectory
106 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
107 TW_UINT16 SANE_ChangeDirectory
108 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
109 TW_UINT16 SANE_FileSystemCopy
110 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
111 TW_UINT16 SANE_CreateDirectory
112 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
113 TW_UINT16 SANE_FileSystemDelete
114 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
115 TW_UINT16 SANE_FormatMedia
116 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
117 TW_UINT16 SANE_FileSystemGetClose
118 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
119 TW_UINT16 SANE_FileSystemGetFirstFile
120 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
121 TW_UINT16 SANE_FileSystemGetInfo
122 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
123 TW_UINT16 SANE_FileSystemGetNextFile
124 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
125 TW_UINT16 SANE_FileSystemRename
126 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
127 TW_UINT16 SANE_ProcessEvent
128 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
129 TW_UINT16 SANE_PassThrough
130 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
131 TW_UINT16 SANE_PendingXfersEndXfer
132 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
133 TW_UINT16 SANE_PendingXfersGet
134 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
135 TW_UINT16 SANE_PendingXfersReset
136 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
137 TW_UINT16 SANE_PendingXfersStopFeeder
138 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
139 TW_UINT16 SANE_SetupFileXferGet
140 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
141 TW_UINT16 SANE_SetupFileXferGetDefault
142 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
143 TW_UINT16 SANE_SetupFileXferReset
144 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
145 TW_UINT16 SANE_SetupFileXferSet
146 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
147 TW_UINT16 SANE_SetupFileXfer2Get
148 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
149 TW_UINT16 SANE_SetupFileXfer2GetDefault
150 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
151 TW_UINT16 SANE_SetupFileXfer2Reset
152 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
153 TW_UINT16 SANE_SetupFileXfer2Set
154 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
155 TW_UINT16 SANE_SetupMemXferGet
156 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
157 TW_UINT16 SANE_GetDSStatus
158 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
159 TW_UINT16 SANE_DisableDSUserInterface
160 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
161 TW_UINT16 SANE_EnableDSUserInterface
162 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
163 TW_UINT16 SANE_EnableDSUIOnly
164 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
165 TW_UINT16 SANE_XferGroupGet
166 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
167 TW_UINT16 SANE_XferGroupSet
168 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
170 /* Implementation of operation triplets
171 * From Application to Source (Image Information) */
172 TW_UINT16 SANE_CIEColorGet
173 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
174 TW_UINT16 SANE_ExtImageInfoGet
175 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
176 TW_UINT16 SANE_GrayResponseReset
177 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
178 TW_UINT16 SANE_GrayResponseSet
179 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
180 TW_UINT16 SANE_ImageFileXferGet
181 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
182 TW_UINT16 SANE_ImageInfoGet
183 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
184 TW_UINT16 SANE_ImageLayoutGet
185 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
186 TW_UINT16 SANE_ImageLayoutGetDefault
187 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
188 TW_UINT16 SANE_ImageLayoutReset
189 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
190 TW_UINT16 SANE_ImageLayoutSet
191 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
192 TW_UINT16 SANE_ImageMemXferGet
193 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
194 TW_UINT16 SANE_ImageNativeXferGet
195 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
196 TW_UINT16 SANE_JPEGCompressionGet
197 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
198 TW_UINT16 SANE_JPEGCompressionGetDefault
199 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
200 TW_UINT16 SANE_JPEGCompressionReset
201 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
202 TW_UINT16 SANE_JPEGCompressionSet
203 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
204 TW_UINT16 SANE_Palette8Get
205 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
206 TW_UINT16 SANE_Palette8GetDefault
207 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
208 TW_UINT16 SANE_Palette8Reset
209 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
210 TW_UINT16 SANE_Palette8Set
211 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
212 TW_UINT16 SANE_RGBResponseReset
213 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
214 TW_UINT16 SANE_RGBResponseSet
215 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
217 /* Implementation of TWAIN capabilities */
218 TW_UINT16
SANE_ICAPXferMech (pTW_CAPABILITY pCapability
, TW_UINT16 action
);
221 BOOL
DoScannerUI(void);
222 HWND
ScanningDialogBox(HWND dialog
, LONG progress
);