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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 # include <sane/sane.h>
31 /* internel information about an active data source */
32 typedef struct tagActiveDS
34 struct tagActiveDS
*next
; /* next active DS */
35 TW_IDENTITY identity
; /* identity */
36 TW_UINT16 currentState
; /* current state */
37 TW_EVENT pendingEvent
; /* pending event to be sent to
39 TW_UINT16 twCC
; /* condition code */
40 HWND hwndOwner
; /* window handle of the app */
42 SANE_Handle deviceHandle
; /* device handle */
43 SANE_Parameters sane_param
; /* parameters about the image
47 TW_UINT16 capXferMech
; /* ICAP_XFERMECH */
50 TW_UINT16 DSM_initialized
; /* whether Source Manager is initialized */
51 TW_UINT16 DSM_currentState
; /* current state of Source Manager */
52 TW_UINT16 DSM_twCC
; /* current condition code of Source Manager */
53 TW_HANDLE DSM_parentHWND
; /* window handle of the Source's "parent" */
54 TW_UINT32 DSM_sourceId
; /* source id generator */
55 TW_UINT16 DSM_currentDevice
; /* keep track of device during enumeration */
57 const SANE_Device
**device_list
;/* a list of all sane devices */
59 activeDS
*activeSources
; /* list of active data sources */
61 /* Helper functions */
62 extern activeDS
*TWAIN_LookupSource (pTW_IDENTITY pDest
);
63 extern TW_UINT16
TWAIN_SaneCapability (activeDS
*pSource
,
64 pTW_CAPABILITY pCapability
, TW_UINT16 action
);
67 extern TW_UINT16
TWAIN_ControlGroupHandler (
68 pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
,
69 TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
70 extern TW_UINT16
TWAIN_ImageGroupHandler (
71 pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
,
72 TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
73 extern TW_UINT16
TWAIN_AudioGroupHandler (
74 pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
,
75 TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
76 extern TW_UINT16
TWAIN_SourceManagerHandler (
77 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
79 /* Implementation of operation triplets (From Application to Source Manager) */
80 extern TW_UINT16 TWAIN_CloseDS
81 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
82 extern TW_UINT16 TWAIN_IdentityGetDefault
83 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
84 extern TW_UINT16 TWAIN_IdentityGetFirst
85 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
86 extern TW_UINT16 TWAIN_IdentityGetNext
87 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
88 extern TW_UINT16 TWAIN_OpenDS
89 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
90 extern TW_UINT16 TWAIN_UserSelect
91 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
92 extern TW_UINT16 TWAIN_CloseDSM
93 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
94 extern TW_UINT16 TWAIN_OpenDSM
95 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
96 extern TW_UINT16 TWAIN_GetDSMStatus
97 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
99 /* Implementation of operation triplets
100 * From Application to Source (Control Information) */
101 TW_UINT16 TWAIN_CapabilityGet
102 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
103 TW_UINT16 TWAIN_CapabilityGetCurrent
104 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
,TW_MEMREF pData
);
105 TW_UINT16 TWAIN_CapabilityGetDefault
106 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
107 TW_UINT16 TWAIN_CapabilityQuerySupport
108 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
109 TW_UINT16 TWAIN_CapabilityReset
110 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
111 TW_UINT16 TWAIN_CapabilitySet
112 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
113 TW_UINT16 TWAIN_CustomDSDataGet
114 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
115 TW_UINT16 TWAIN_CustomDSDataSet
116 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
117 TW_UINT16 TWAIN_AutomaticCaptureDirectory
118 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
119 TW_UINT16 TWAIN_ChangeDirectory
120 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
121 TW_UINT16 TWAIN_FileSystemCopy
122 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
123 TW_UINT16 TWAIN_CreateDirectory
124 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
125 TW_UINT16 TWAIN_FileSystemDelete
126 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
127 TW_UINT16 TWAIN_FormatMedia
128 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
129 TW_UINT16 TWAIN_FileSystemGetClose
130 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
131 TW_UINT16 TWAIN_FileSystemGetFirstFile
132 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
133 TW_UINT16 TWAIN_FileSystemGetInfo
134 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
135 TW_UINT16 TWAIN_FileSystemGetNextFile
136 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
137 TW_UINT16 TWAIN_FileSystemRename
138 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
139 TW_UINT16 TWAIN_ProcessEvent
140 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
141 TW_UINT16 TWAIN_PassThrough
142 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
143 TW_UINT16 TWAIN_PendingXfersEndXfer
144 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
145 TW_UINT16 TWAIN_PendingXfersGet
146 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
147 TW_UINT16 TWAIN_PendingXfersReset
148 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
149 TW_UINT16 TWAIN_PendingXfersStopFeeder
150 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
151 TW_UINT16 TWAIN_SetupFileXferGet
152 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
153 TW_UINT16 TWAIN_SetupFileXferGetDefault
154 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
155 TW_UINT16 TWAIN_SetupFileXferReset
156 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
157 TW_UINT16 TWAIN_SetupFileXferSet
158 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
159 TW_UINT16 TWAIN_SetupFileXfer2Get
160 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
161 TW_UINT16 TWAIN_SetupFileXfer2GetDefault
162 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
163 TW_UINT16 TWAIN_SetupFileXfer2Reset
164 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
165 TW_UINT16 TWAIN_SetupFileXfer2Set
166 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
167 TW_UINT16 TWAIN_SetupMemXferGet
168 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
169 TW_UINT16 TWAIN_GetDSStatus
170 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
171 TW_UINT16 TWAIN_DisableDSUserInterface
172 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
173 TW_UINT16 TWAIN_EnableDSUserInterface
174 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
175 TW_UINT16 TWAIN_EnableDSUIOnly
176 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
177 TW_UINT16 TWAIN_XferGroupGet
178 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
179 TW_UINT16 TWAIN_XferGroupSet
180 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
182 /* Implementation of operation triplets
183 * From Application to Source (Image Information) */
184 TW_UINT16 TWAIN_CIEColorGet
185 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
186 TW_UINT16 TWAIN_ExtImageInfoGet
187 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
188 TW_UINT16 TWAIN_GrayResponseReset
189 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
190 TW_UINT16 TWAIN_GrayResponseSet
191 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
192 TW_UINT16 TWAIN_ImageFileXferGet
193 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
194 TW_UINT16 TWAIN_ImageInfoGet
195 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
196 TW_UINT16 TWAIN_ImageLayoutGet
197 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
198 TW_UINT16 TWAIN_ImageLayoutGetDefault
199 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
200 TW_UINT16 TWAIN_ImageLayoutReset
201 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
202 TW_UINT16 TWAIN_ImageLayoutSet
203 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
204 TW_UINT16 TWAIN_ImageMemXferGet
205 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
206 TW_UINT16 TWAIN_ImageNativeXferGet
207 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
208 TW_UINT16 TWAIN_JPEGCompressionGet
209 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
210 TW_UINT16 TWAIN_JPEGCompressionGetDefault
211 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
212 TW_UINT16 TWAIN_JPEGCompressionReset
213 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
214 TW_UINT16 TWAIN_JPEGCompressionSet
215 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
216 TW_UINT16 TWAIN_Palette8Get
217 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
218 TW_UINT16 TWAIN_Palette8GetDefault
219 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
220 TW_UINT16 TWAIN_Palette8Reset
221 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
222 TW_UINT16 TWAIN_Palette8Set
223 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
224 TW_UINT16 TWAIN_RGBResponseReset
225 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
226 TW_UINT16 TWAIN_RGBResponseSet
227 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
229 /* Implementation of operation triplets
230 * From Application to Source (Audio Information) */
231 TW_UINT16 TWAIN_AudioFileXferGet
232 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
233 TW_UINT16 TWAIN_AudioInfoGet
234 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
235 TW_UINT16 TWAIN_AudioNativeXferGet
236 (pTW_IDENTITY pOrigin
, pTW_IDENTITY pDest
, TW_MEMREF pData
);
238 /* Implementation of TWAIN capabilities */
239 TW_UINT16 TWAIN_ICAPXferMech
240 (activeDS
*pSource
, pTW_CAPABILITY pCapability
, TW_UINT16 action
);