mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-25 06:26:25 +00:00
sane.ds: Add support for word list options.
Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
72e5f1af3d
commit
31a4a58f81
|
@ -716,6 +716,23 @@ static BOOL UpdateSaneBoolOption(int index, BOOL position)
|
||||||
return FALSE;
|
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)
|
static BOOL UpdateSaneStringOption(int index, SANE_String value)
|
||||||
{
|
{
|
||||||
SANE_Status rc = SANE_STATUS_GOOD;
|
SANE_Status rc = SANE_STATUS_GOOD;
|
||||||
|
@ -791,6 +808,21 @@ static INT_PTR InitializeDialog(HWND hwnd)
|
||||||
SendMessageA(control,BM_SETCHECK,BST_CHECKED,0);
|
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)
|
else if (opt->constraint_type == SANE_CONSTRAINT_RANGE)
|
||||||
{
|
{
|
||||||
if (opt->type == SANE_TYPE_INT)
|
if (opt->type == SANE_TYPE_INT)
|
||||||
|
@ -977,6 +1009,11 @@ static void ComboChanged(HWND hwnd, INT id, HWND control)
|
||||||
if (UpdateSaneStringOption(index, value))
|
if (UpdateSaneStringOption(index, value))
|
||||||
InitializeDialog(hwnd);
|
InitializeDialog(hwnd);
|
||||||
}
|
}
|
||||||
|
else if (opt->type == SANE_TYPE_INT)
|
||||||
|
{
|
||||||
|
if (UpdateSaneIntOption(index, atoi(value)))
|
||||||
|
InitializeDialog(hwnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue