From: Bernd Herd codeberg@herdsoft.com
If ADF is enabled and not filled with paper, display an error message to the user and allow a retry.
Also displays paper jammed message and cover open message.
Added german translation for error messages and progress dialog elements --- dlls/sane.ds/ds_image.c | 68 +++++++++++++++++++++++++++++++++++++++-- dlls/sane.ds/resource.h | 4 +++ dlls/sane.ds/sane.rc | 4 +++ dlls/sane.ds/unixlib.c | 8 +++-- po/de.po | 24 +++++++++++++++ 5 files changed, 103 insertions(+), 5 deletions(-)
diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c index 27662ffc358..f06d3b92256 100644 --- a/dlls/sane.ds/ds_image.c +++ b/dlls/sane.ds/ds_image.c @@ -27,6 +27,24 @@
WINE_DEFAULT_DEBUG_CHANNEL(twain);
+/// Sane result codes from sane.h +typedef enum +{ + SANE_STATUS_GOOD = 0, /* everything A-OK */ + SANE_STATUS_UNSUPPORTED, /* operation is not supported */ + SANE_STATUS_CANCELLED, /* operation was cancelled */ + SANE_STATUS_DEVICE_BUSY, /* device is busy; try again later */ + SANE_STATUS_INVAL, /* data is invalid (includes no dev at open) */ + SANE_STATUS_EOF, /* no more data available (end-of-file) */ + SANE_STATUS_JAMMED, /* document feeder jammed */ + SANE_STATUS_NO_DOCS, /* document feeder out of documents */ + SANE_STATUS_COVER_OPEN, /* scanner cover is open */ + SANE_STATUS_IO_ERROR, /* error during device I/O */ + SANE_STATUS_NO_MEM, /* out of memory */ + SANE_STATUS_ACCESS_DENIED /* access to resource has been denied */ +} +SANE_Status; +
/* transition from state 6 to state 7. * @@ -42,6 +60,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain); TW_UINT16 SANE_Start(void) { TW_UINT16 twRC = TWRC_SUCCESS; + SANE_Status status; + TRACE("SANE_Start currentState:%d\n", activeDS.currentState); if (activeDS.currentState != 6) { @@ -53,8 +73,52 @@ TW_UINT16 SANE_Start(void) /* Open progress dialog */ activeDS.progressWnd = ScanningDialogBox(activeDS.progressWnd,0);
- /* Start the scan process in sane */ - if (SANE_CALL( start_device, NULL )) + do + { + /* Start the scan process in sane */ + status = SANE_CALL( start_device, NULL ); + + if (status == SANE_STATUS_GOOD) + { + twRC = TWRC_SUCCESS; + } + else if (!activeDS.capIndicators) + { + twRC = TWRC_FAILURE; + } + else + { + char szCaption[256]; + char szMessage[1024]; + + LoadStringA( SANE_instance, IDS_CAPTION, szCaption, ARRAY_SIZE( szCaption ) ); + switch (status) + { + case SANE_STATUS_NO_DOCS: + LoadStringA( SANE_instance, IDS_NO_DOCS, szMessage, ARRAY_SIZE( szMessage ) ); + twRC = + activeDS.scannedImages!=0 ? TWRC_FAILURE : + MessageBoxA(activeDS.progressWnd, szMessage, szCaption, MB_ICONWARNING | MB_RETRYCANCEL)==IDCANCEL ? TWRC_FAILURE :TWRC_CHECKSTATUS; + break; + case SANE_STATUS_JAMMED: + LoadStringA( SANE_instance, IDS_JAMMED, szMessage, ARRAY_SIZE( szMessage ) ); + twRC = + MessageBoxA(activeDS.progressWnd, szMessage, szCaption, MB_ICONWARNING | MB_RETRYCANCEL)==IDCANCEL ? TWRC_FAILURE :TWRC_CHECKSTATUS; + break; + case SANE_STATUS_COVER_OPEN: + LoadStringA( SANE_instance, IDS_COVER_OPEN, szMessage, ARRAY_SIZE( szMessage ) ); + twRC = + MessageBoxA(activeDS.progressWnd, szMessage, szCaption, MB_ICONWARNING | MB_RETRYCANCEL)==IDCANCEL ? TWRC_FAILURE :TWRC_CHECKSTATUS; + break; + default: + twRC = TWRC_FAILURE; + } + } + } + while (twRC == TWRC_CHECKSTATUS); + + /* If starting the scan failed, cancel scan job */ + if (twRC != TWRC_SUCCESS) { activeDS.progressWnd = ScanningDialogBox(activeDS.progressWnd, -1); activeDS.twCC = TWCC_OPERATIONERROR; diff --git a/dlls/sane.ds/resource.h b/dlls/sane.ds/resource.h index f52e7956e4b..8b792f362c5 100644 --- a/dlls/sane.ds/resource.h +++ b/dlls/sane.ds/resource.h @@ -36,3 +36,7 @@ #define IDS_COLOUR 0x502 #define IDS_LINEART 0x503 #define IDS_UNKNOWN 0x504 +#define IDS_CAPTION 0x505 +#define IDS_NO_DOCS 0x506 +#define IDS_JAMMED 0x507 +#define IDS_COVER_OPEN 0x508 diff --git a/dlls/sane.ds/sane.rc b/dlls/sane.ds/sane.rc index cc2a44302ab..138b3f9694e 100644 --- a/dlls/sane.ds/sane.rc +++ b/dlls/sane.ds/sane.rc @@ -41,6 +41,10 @@ BEGIN IDS_COLOUR,"Color" IDS_LINEART,"LineArt" IDS_UNKNOWN,"Unknown" + IDS_CAPTION,"Scanning" + IDS_NO_DOCS,"The Automatic Document Feeder (ADF) is empty. Please insert the sheets to be scanned" + IDS_JAMMED,"The scanner reports a paper jam. Please insert the sheets to be scanned" + IDS_COVER_OPEN,"The scanner cover is open. Please close the scanner" END
diff --git a/dlls/sane.ds/unixlib.c b/dlls/sane.ds/unixlib.c index 9531c758746..011a00d07b7 100644 --- a/dlls/sane.ds/unixlib.c +++ b/dlls/sane.ds/unixlib.c @@ -299,10 +299,12 @@ static NTSTATUS start_device( void *args ) if (status != SANE_STATUS_GOOD) { TRACE("sane_start returns %s\n", sane_strstatus(status)); - return STATUS_DEVICE_NOT_CONNECTED; } - device_started = TRUE; - return STATUS_SUCCESS; + else + { + device_started = TRUE; + } + return status; }
static NTSTATUS cancel_device( void *args ) diff --git a/po/de.po b/po/de.po index 8c6b6d6e218..a2a61550855 100644 --- a/po/de.po +++ b/po/de.po @@ -9696,6 +9696,30 @@ msgstr "Scanne" msgid "SCANNING... Please Wait" msgstr "SCANNE... Bitte warten"
+msgid "Manufacturer:" +msgstr "Hersteller:" + +msgid "Productfamily:" +msgstr "Produktfamilie:" + +msgid "Productname:" +msgstr "Produktname:" + +msgid "Resolution:" +msgstr "Auflösung:" + +msgid "LineArt" +msgstr "S/W" + +msgid "The Automatic Document Feeder (ADF) is empty. Please insert the sheets to be scanned" +msgstr "Der Automatische Vorlageneinzug (ADF) ist leer. Bitte legen Sie die zu scannended Blätter ein" + +msgid "The scanner reports a paper jam. Please insert the sheets to be scanned" +msgstr "Der Scanner meldet einen papierstau. Bitte legen Sie die zu scannended Blätter ein" + +msgid "The scanner cover is open. Please close the scanner" +msgstr "Die Scanner-Abdeckung ist offen. Bitte schließen Sie den Scanner" + #: dlls/sane.ds/sane.rc:31 msgctxt "unit: pixels" msgid "px"