1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

sane.ds: Add SANE option settable flag support.

This commit is contained in:
Ilia Docin 2024-06-23 21:15:09 +03:00 committed by Alexandre Julliard
parent d1a62e862e
commit ac4e478015
3 changed files with 5 additions and 0 deletions

View File

@ -59,6 +59,7 @@ TW_UINT16 sane_option_set_int(const char *option_name, int val, BOOL *needs_relo
{
struct option_descriptor opt;
TW_UINT16 rc = sane_find_option(option_name, TYPE_INT, &opt);
if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, &val, needs_reload );
return rc;
@ -77,6 +78,7 @@ TW_UINT16 sane_option_set_bool(const char *option_name, int val )
{
struct option_descriptor opt;
TW_UINT16 rc = sane_find_option(option_name, TYPE_BOOL, &opt);
if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, &val, NULL );
return rc;
@ -102,6 +104,7 @@ TW_UINT16 sane_option_set_str(const char *option_name, char *val, BOOL *needs_re
{
struct option_descriptor opt;
TW_UINT16 rc = sane_find_option(option_name, TYPE_STRING, &opt);
if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, val, needs_reload );
return rc;

View File

@ -159,6 +159,7 @@ static void map_descr( struct option_descriptor *descr, const SANE_Option_Descri
descr->constraint_type = map_constraint_type( opt->constraint_type );
descr->size = opt->size;
descr->is_active = SANE_OPTION_IS_ACTIVE( opt->cap );
descr->is_settable = SANE_OPTION_IS_SETTABLE( opt->cap );
if (opt->title) len = ntdll_umbstowcs( opt->title, strlen(opt->title),
descr->title, ARRAY_SIZE(descr->title) );
descr->title[len] = 0;

View File

@ -39,6 +39,7 @@ struct option_descriptor
int optno;
int size;
int is_active;
int is_settable;
enum { TYPE_BOOL, TYPE_INT, TYPE_FIXED, TYPE_STRING, TYPE_BUTTON, TYPE_GROUP } type;
enum { UNIT_NONE, UNIT_PIXEL, UNIT_BIT, UNIT_MM, UNIT_DPI, UNIT_PERCENT, UNIT_MICROSECOND } unit;
enum { CONSTRAINT_NONE, CONSTRAINT_RANGE, CONSTRAINT_WORD_LIST, CONSTRAINT_STRING_LIST } constraint_type;