Vincent Povirk : sane.ds: Add support for word list options.
Alexandre Julliard
julliard at winehq.org
Mon Sep 11 15:08:00 CDT 2017
Module: wine
Branch: master
Commit: 31a4a58f81caf2aa6ee7a1e0540917b1b8ad7e14
URL: http://source.winehq.org/git/wine.git/?a=commit;h=31a4a58f81caf2aa6ee7a1e0540917b1b8ad7e14
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Sep 11 13:47:55 2017 -0500
sane.ds: Add support for word list options.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/sane.ds/ui.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c
index 5574c5a..9a9bcb0 100644
--- a/dlls/sane.ds/ui.c
+++ b/dlls/sane.ds/ui.c
@@ -716,6 +716,23 @@ static BOOL UpdateSaneBoolOption(int index, BOOL position)
return FALSE;
}
+static BOOL UpdateSaneIntOption(int index, SANE_Int value)
+{
+ SANE_Status rc = SANE_STATUS_GOOD;
+ SANE_Int result = 0;
+
+ rc = psane_control_option (activeDS.deviceHandle,index,
+ SANE_ACTION_SET_VALUE, &value, &result);
+
+ if(rc == SANE_STATUS_GOOD)
+ {
+ if (result & SANE_INFO_RELOAD_OPTIONS ||
+ result & SANE_INFO_RELOAD_PARAMS || result & SANE_INFO_INEXACT)
+ return TRUE;
+ }
+ return FALSE;
+}
+
static BOOL UpdateSaneStringOption(int index, SANE_String value)
{
SANE_Status rc = SANE_STATUS_GOOD;
@@ -791,6 +808,21 @@ static INT_PTR InitializeDialog(HWND hwnd)
SendMessageA(control,BM_SETCHECK,BST_CHECKED,0);
}
+ else if (opt->type == SANE_TYPE_INT &&
+ opt->constraint_type == SANE_CONSTRAINT_WORD_LIST)
+ {
+ int j, count = opt->constraint.word_list[0];
+ CHAR buffer[16];
+ SANE_Int val;
+ for (j=1; j<=count; j++)
+ {
+ sprintf(buffer, "%d", opt->constraint.word_list[j]);
+ SendMessageA(control, CB_ADDSTRING, 0, (LPARAM)buffer);
+ }
+ psane_control_option(activeDS.deviceHandle, i, SANE_ACTION_GET_VALUE, &val, NULL);
+ sprintf(buffer, "%d", val);
+ SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
+ }
else if (opt->constraint_type == SANE_CONSTRAINT_RANGE)
{
if (opt->type == SANE_TYPE_INT)
@@ -977,6 +1009,11 @@ static void ComboChanged(HWND hwnd, INT id, HWND control)
if (UpdateSaneStringOption(index, value))
InitializeDialog(hwnd);
}
+ else if (opt->type == SANE_TYPE_INT)
+ {
+ if (UpdateSaneIntOption(index, atoi(value)))
+ InitializeDialog(hwnd);
+ }
}
More information about the wine-cvs
mailing list