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