add three new SANE_VALUE macros and use mode name macros from saneopts.h

merge-requests/1/head
m. allan noah 2010-02-10 23:48:21 -05:00
rodzic 47df67a7bd
commit ff048f4176
58 zmienionych plików z 369 dodań i 326 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2010-02-10 m. allan noah <kitno455 at gmail dot com>
* include/sane/saneopts.h: add three new SANE_VALUE macros
* backend/*.[ch]: use mode name macros from saneopts.h by Robert Ancell
2010-02-10 m. allan noah <kitno455 at gmail dot com>
* doc/descriptions/hpaio.desc: updated from hplip v3.9.12
* po/sane-backends.nl.po: updates from Armijn Hemel

Wyświetl plik

@ -342,11 +342,11 @@ set_window (Abaton_Scanner * s)
invert = s->val[OPT_NEGATIVE].w;
if (!strcmp (s->val[OPT_MODE].s, "Lineart"))
if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART))
{
STORE8 (window + 17, 0);
}
else if (!strcmp (s->val[OPT_MODE].s, "Halftone"))
else if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_HALFTONE))
{
STORE8 (window + 17, 1);
}
@ -513,7 +513,7 @@ calc_parameters (Abaton_Scanner * s)
DBG (FLOW_CONTROL, "Entering calc_parameters\n");
if (!strcmp (val, "Lineart") || !strcmp (val, "Halftone"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) || !strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE))
{
s->params.depth = 1;
s->bpp = 1;
@ -583,14 +583,14 @@ mode_update (SANE_Handle handle, char *val)
{
Abaton_Scanner *s = handle;
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
{
DISABLE (OPT_BRIGHTNESS);
DISABLE (OPT_CONTRAST);
ENABLE (OPT_THRESHOLD);
DISABLE (OPT_HALFTONE_PATTERN);
}
else if (!strcmp (val, "Halftone"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE))
{
ENABLE (OPT_BRIGHTNESS);
ENABLE (OPT_CONTRAST);
@ -660,12 +660,12 @@ init_options (Abaton_Scanner * s)
s->opt[OPT_MODE_GROUP].cap = 0;
s->opt[OPT_MODE_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
mode_list[0]="Lineart";
mode_list[0]=SANE_VALUE_SCAN_MODE_LINEART;
switch (s->hw->ScannerModel)
{
case ABATON_300GS:
mode_list[1]="Halftone";
mode_list[1]=SANE_VALUE_SCAN_MODE_HALFTONE;
mode_list[2]="Gray16";
mode_list[3]="Gray256";
mode_list[4]=NULL;

Wyświetl plik

@ -679,16 +679,16 @@ return SANE_STATUS_GOOD;
/* The Mode */
if (!strcmp (s->val[OPT_MODE].s, "Lineart"))
if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART))
STORE8 (WP + 25, 0)
else if (!strcmp (s->val[OPT_MODE].s, "Halftone"))
else if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_HALFTONE))
STORE8 (WP + 25, 1)
else if (!strcmp (s->val[OPT_MODE].s, "Gray") ||
else if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) ||
!strcmp (s->val[OPT_MODE].s, "Gray16"))
STORE8 (WP + 25, 2)
else if (!strcmp (s->val[OPT_MODE].s, "BiColor"))
STORE8 (WP + 25, 3)
else if (!strcmp (s->val[OPT_MODE].s, "Color"))
else if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR))
STORE8 (WP + 25, 5)
else
{
@ -880,14 +880,14 @@ calc_parameters (Apple_Scanner * s)
DBG (FLOW_CONTROL, "Entering calc_parameters\n");
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
{
s->params.last_frame = SANE_TRUE;
s->params.format = SANE_FRAME_GRAY;
s->params.depth = 1;
s->bpp = 1;
}
else if (!strcmp (val, "Halftone"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE))
{
s->params.last_frame = SANE_TRUE;
s->params.format = SANE_FRAME_GRAY;
@ -901,7 +901,7 @@ calc_parameters (Apple_Scanner * s)
s->params.depth = 8;
s->bpp = 4;
}
else if (!strcmp (val, "Gray"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_GRAY))
{
s->params.last_frame = SANE_TRUE;
s->params.format = SANE_FRAME_GRAY;
@ -915,7 +915,7 @@ calc_parameters (Apple_Scanner * s)
s->params.depth = 24;
s->bpp = 3;
}
else if (!strcmp (val, "Color"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_COLOR))
{
s->params.last_frame = SANE_FALSE;
s->params.format = SANE_FRAME_RED;
@ -1065,7 +1065,7 @@ Apple_Scanner *s = handle;
if (s->hw->ScannerModel == COLORONESCANNER)
{
if ( !strcmp(s->val[OPT_MODE].s,"Gray") ||
if ( !strcmp(s->val[OPT_MODE].s,SANE_VALUE_SCAN_MODE_GRAY) ||
!strcmp(s->val[OPT_MODE].s,"Gray16") )
{
ENABLE (OPT_CUSTOM_GAMMA);
@ -1102,7 +1102,7 @@ if (s->hw->ScannerModel == COLORONESCANNER)
goto discustom;
}
}
else if (!strcmp(s->val[OPT_MODE].s,"Color"))
else if (!strcmp(s->val[OPT_MODE].s,SANE_VALUE_SCAN_MODE_COLOR))
{
ENABLE (OPT_CUSTOM_GAMMA);
if (s->val[OPT_CUSTOM_GAMMA].w)
@ -1146,7 +1146,7 @@ mode_update (SANE_Handle handle, char *val)
DISABLE(OPT_COLOR_SENSOR);
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
{
if (s->hw->ScannerModel == APPLESCANNER)
ENABLE (OPT_AUTOBACKGROUND);
@ -1156,12 +1156,12 @@ mode_update (SANE_Handle handle, char *val)
UseThreshold=SANE_TRUE;
}
else if (!strcmp (val, "Halftone"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE))
{
DISABLE (OPT_AUTOBACKGROUND);
ENABLE (OPT_HALFTONE_PATTERN);
}
else if (!strcmp (val, "Gray16") || !strcmp (val, "Gray"))
else if (!strcmp (val, "Gray16") || !strcmp (val, SANE_VALUE_SCAN_MODE_GRAY))
{
DISABLE (OPT_AUTOBACKGROUND);
DISABLE (OPT_HALFTONE_PATTERN);
@ -1175,7 +1175,7 @@ mode_update (SANE_Handle handle, char *val)
DISABLE (OPT_HALFTONE_PATTERN);
UseThreshold=SANE_TRUE;
}
else if (!strcmp (val, "Color"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_COLOR))
{
DISABLE (OPT_AUTOBACKGROUND);
DISABLE (OPT_HALFTONE_PATTERN);
@ -1329,27 +1329,27 @@ init_options (Apple_Scanner * s)
switch (s->hw->ScannerModel)
{
case APPLESCANNER:
mode_list[0]="Lineart";
mode_list[1]="Halftone";
mode_list[0]=SANE_VALUE_SCAN_MODE_LINEART;
mode_list[1]=SANE_VALUE_SCAN_MODE_HALFTONE;
mode_list[2]="Gray16";
mode_list[3]=NULL;
break;
case ONESCANNER:
mode_list[0]="Lineart";
mode_list[1]="Halftone";
mode_list[0]=SANE_VALUE_SCAN_MODE_LINEART;
mode_list[1]=SANE_VALUE_SCAN_MODE_HALFTONE;
mode_list[2]="Gray16";
mode_list[3]="Gray";
mode_list[3]=SANE_VALUE_SCAN_MODE_GRAY;
mode_list[4]=NULL;
halftone_pattern_list[3]="spiral8x8";
halftone_pattern_list[4]="bayer8x8";
halftone_pattern_list[5]=NULL;
break;
case COLORONESCANNER:
mode_list[0]="Lineart";
mode_list[0]=SANE_VALUE_SCAN_MODE_LINEART;
mode_list[1]="Gray16";
mode_list[2]="Gray";
mode_list[2]=SANE_VALUE_SCAN_MODE_GRAY;
mode_list[3]="BiColor";
mode_list[4]="Color";
mode_list[4]=SANE_VALUE_SCAN_MODE_COLOR;
mode_list[5]=NULL;
break;
default:
@ -1493,7 +1493,7 @@ init_options (Apple_Scanner * s)
s->opt[OPT_AUTOBACKGROUND].title = "Use Auto Background Adjustment";
s->opt[OPT_AUTOBACKGROUND].desc =
"Enables/Disables the Auto Background Adjustment feature";
if (strcmp (s->val[OPT_MODE].s, "Lineart")
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART)
|| (s->hw->ScannerModel != APPLESCANNER))
DISABLE (OPT_AUTOBACKGROUND);
s->opt[OPT_AUTOBACKGROUND].type = SANE_TYPE_BOOL;
@ -1682,7 +1682,7 @@ init_options (Apple_Scanner * s)
/* Color Functions: Advanced */
s->opt[OPT_COLOR_GROUP].title = "Color";
s->opt[OPT_COLOR_GROUP].title = SANE_VALUE_SCAN_MODE_COLOR;
s->opt[OPT_COLOR_GROUP].desc = "";
s->opt[OPT_COLOR_GROUP].type = SANE_TYPE_GROUP;
s->opt[OPT_COLOR_GROUP].cap = SANE_CAP_ADVANCED;

Wyświetl plik

@ -100,7 +100,10 @@ static ARTEC_Scanner *first_handle;
static const SANE_String_Const mode_list[] =
{
"Lineart", "Halftone", "Gray", "Color",
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -1355,22 +1358,22 @@ artec_set_scan_window (SANE_Handle handle)
* byte 33 is mode
* byte 37 bit 7 is "negative" setting
*/
if (strcmp (s->mode, "Lineart") == 0)
if (strcmp (s->mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
data[33] = ARTEC_COMP_LINEART;
data[37] = (s->val[OPT_NEGATIVE].w == SANE_TRUE) ? 0x0 : 0x80;
}
else if (strcmp (s->mode, "Halftone") == 0)
else if (strcmp (s->mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
data[33] = ARTEC_COMP_HALFTONE;
data[37] = (s->val[OPT_NEGATIVE].w == SANE_TRUE) ? 0x0 : 0x80;
}
else if (strcmp (s->mode, "Gray") == 0)
else if (strcmp (s->mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
data[33] = ARTEC_COMP_GRAY;
data[37] = (s->val[OPT_NEGATIVE].w == SANE_TRUE) ? 0x80 : 0x0;
}
else if (strcmp (s->mode, "Color") == 0)
else if (strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
data[33] = ARTEC_COMP_COLOR;
data[37] = (s->val[OPT_NEGATIVE].w == SANE_TRUE) ? 0x80 : 0x0;
@ -2989,7 +2992,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_FILTER_TYPE].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_NEGATIVE].cap &= ~SANE_CAP_INACTIVE;
if (strcmp (val, "Lineart") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
/* Lineart mode */
s->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE; /* OFF */
@ -2998,13 +3001,13 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (s->hw->flags & ARTEC_FLAG_ENHANCE_LINE_EDGE)
s->opt[OPT_EDGE_ENH].cap &= ~SANE_CAP_INACTIVE;
}
else if (strcmp (val, "Halftone") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
/* Halftone mode */
if (s->hw->flags & ARTEC_FLAG_HALFTONE_PATTERN)
s->opt[OPT_HALFTONE_PATTERN].cap &= ~SANE_CAP_INACTIVE;
}
else if (strcmp (val, "Gray") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
/* Grayscale mode */
if (!(s->hw->flags & ARTEC_FLAG_MBPP_NEGATIVE))
@ -3012,7 +3015,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_NEGATIVE].cap |= SANE_CAP_INACTIVE;
}
}
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
/* Color mode */
s->opt[OPT_FILTER_TYPE].cap |= SANE_CAP_INACTIVE;
@ -3084,13 +3087,13 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = s->val[OPT_MODE].s;
if ((strcmp (mode, "Lineart") == 0) ||
(strcmp (mode, "Halftone") == 0) ||
(strcmp (mode, "Gray") == 0))
if ((strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0) ||
(strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0) ||
(strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0))
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
}
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
@ -3201,15 +3204,15 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
if ((s->val[OPT_PREVIEW].w == SANE_TRUE) &&
(s->val[OPT_GRAY_PREVIEW].w == SANE_TRUE))
{
s->mode = "Gray";
s->mode = SANE_VALUE_SCAN_MODE_GRAY;
}
else
{
s->mode = s->val[OPT_MODE].s;
}
if ((strcmp (s->mode, "Lineart") == 0) ||
(strcmp (s->mode, "Halftone") == 0))
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_LINEART) == 0) ||
(strcmp (s->mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0))
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = (s->params.pixels_per_line + 7) / 8;
@ -3223,7 +3226,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
/* full, so this should not affect scans in a negative way */
s->params.pixels_per_line = s->params.bytes_per_line * 8;
}
else if (strcmp (s->mode, "Gray") == 0)
else if (strcmp (s->mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
@ -3320,11 +3323,11 @@ sane_start (SANE_Handle handle)
return status;
/* DAL: For 3 pass colour set the current pass parameters */
if ((strcmp (s->mode, "Color") == 0) && s->threepasscolor)
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0) && s->threepasscolor)
set_pass_parameters (s);
/* DAL: For single pass scans and the first pass of a 3 pass scan */
if ((strcmp (s->mode, "Color") != 0) ||
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) != 0) ||
(!s->threepasscolor) ||
((s->threepasscolor) &&
(s->this_pass == 1)))
@ -3365,7 +3368,7 @@ sane_start (SANE_Handle handle)
s->x_resolution, s->y_resolution, (u_long) s->bytes_to_read);
/* DAL: For single pass scans and the first pass of a 3 pass scan */
if ((strcmp (s->mode, "Color") != 0) || !s->threepasscolor ||
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) != 0) || !s->threepasscolor ||
(s->threepasscolor && s->this_pass == 1))
{
@ -3418,7 +3421,7 @@ sane_start (SANE_Handle handle)
/* now we can start the actual scan */
/* DAL: For single pass scans and the first pass of a 3 pass scan */
if ((strcmp (s->mode, "Color") != 0) ||
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) != 0) ||
(!s->threepasscolor) ||
(s->this_pass == 1))
{
@ -3480,7 +3483,7 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int
if (s->bytes_to_read == 0)
{
if ((strcmp (s->mode, "Color") != 0) || !s->threepasscolor ||
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) != 0) || !s->threepasscolor ||
(s->threepasscolor && s->this_pass == 3))
{
do_cancel (s);
@ -3573,7 +3576,7 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int
write (debug_fd, temp_buf, nread);
}
if ((strcmp (s->mode, "Color") == 0) &&
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0) &&
(s->hw->flags & ARTEC_FLAG_RGB_LINE_OFFSET))
{
for (line = 0; line < lread; line++)
@ -3614,12 +3617,12 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int
else
{
if ((s->hw->flags & ARTEC_FLAG_IMAGE_REV_LR) ||
((strcmp (s->mode, "Color") == 0) &&
((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0) &&
(s->hw->flags & ARTEC_FLAG_RGB_CHAR_SHIFT)))
{
for (line = 0; line < lread; line++)
{
if ((strcmp (s->mode, "Color") == 0) &&
if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0) &&
(s->hw->flags & ARTEC_FLAG_RGB_CHAR_SHIFT))
{
artec_line_rgb_to_byte_rgb (temp_buf +
@ -3636,7 +3639,7 @@ artec_sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int
/* do software calibration if necessary */
if ((s->val[OPT_SOFTWARE_CAL].w) &&
(strcmp (s->mode, "Color") == 0))
(strcmp (s->mode, SANE_VALUE_SCAN_MODE_COLOR) == 0))
{
artec_software_rgb_calibrate (s, temp_buf, lread);
}

Wyświetl plik

@ -151,9 +151,9 @@ static SANE_Word recv_small_res_value = 0x2013; /**< Receive small result - wVal
static SANE_Word recv_small_res_index = 0x3f00; /**< Receive small result - wIndex */
static SANE_String_Const mode_list[] = {
SANE_I18N ("Lineart"),
SANE_I18N ("Grayscale"),
SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
NULL
};

Wyświetl plik

@ -76,7 +76,9 @@ static SANE_Status attach (const char *devname, AS6E_Device ** devp);
/* static SANE_Status attach_one (const char *dev); */
static const SANE_String_Const mode_list[] = {
"Lineart", "Gray", "Color",
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -314,11 +316,11 @@ sane_start (SANE_Handle handle)
return (SANE_STATUS_IO_ERROR);
DBG (1, "sending start_scan signal\n");
scan_params[0] = s->as6e_params.resolution;
if (strcmp (s->value[OPT_MODE].s, "Color") == 0)
if (strcmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
scan_params[1] = 0;
else if (strcmp (s->value[OPT_MODE].s, "Gray") == 0)
else if (strcmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) == 0)
scan_params[1] = 1;
else if (strcmp (s->value[OPT_MODE].s, "Lineart") == 0)
else if (strcmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
scan_params[1] = 2;
else
return (SANE_STATUS_JAMMED); /*this should never happen */
@ -376,15 +378,15 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
(s->as6e_params.stopline -
s->as6e_params.startline) * s->as6e_params.resolution / 300;
mode = s->value[OPT_MODE].s;
/* if ((strcmp (s->mode, "Lineart") == 0) ||
(strcmp (s->mode, "Halftone") == 0))
/* if ((strcmp (s->mode, SANE_VALUE_SCAN_MODE_LINEART) == 0) ||
(strcmp (s->mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0))
{
s->sane_params.format = SANE_FRAME_GRAY;
s->sane_params.bytes_per_line = (s->sane_params.pixels_per_line + 7) / 8;
s->sane_params.depth = 1;
} */
/*else*/ if ((strcmp (mode, "Gray") == 0)
|| (strcmp (mode, "Lineart") == 0))
/*else*/ if ((strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0))
{
s->sane_params.format = SANE_FRAME_GRAY;
s->sane_params.bytes_per_line = s->sane_params.pixels_per_line;

Wyświetl plik

@ -4308,12 +4308,12 @@ additional_probe (Avision_Scanner* s)
if (!dev->inquiry_no_gray_modes)
{
if (dev->inquiry_bits_per_channel > 0) {
add_color_mode (dev, AV_THRESHOLDED, "Lineart");
add_color_mode (dev, AV_THRESHOLDED, SANE_VALUE_SCAN_MODE_LINEART);
add_color_mode (dev, AV_DITHERED, "Dithered");
}
if (dev->inquiry_bits_per_channel >= 8)
add_color_mode (dev, AV_GRAYSCALE, "Gray");
add_color_mode (dev, AV_GRAYSCALE, SANE_VALUE_SCAN_MODE_GRAY);
if (dev->inquiry_bits_per_channel == 12)
add_color_mode (dev, AV_GRAYSCALE12, "12bit Gray");
@ -4323,7 +4323,7 @@ additional_probe (Avision_Scanner* s)
}
if (dev->inquiry_channels_per_pixel > 1) {
add_color_mode (dev, AV_TRUECOLOR, "Color");
add_color_mode (dev, AV_TRUECOLOR, SANE_VALUE_SCAN_MODE_COLOR);
if (dev->inquiry_bits_per_channel == 12)
add_color_mode (dev, AV_TRUECOLOR12, "12bit Color");

Wyświetl plik

@ -700,8 +700,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (s->val[option].s)
free (s->val[option].s);
s->val[option].s = strdup (val);
if (!strcmp (val, SANE_I18N("Lineart"))
|| !strcmp (val, SANE_I18N("Halftone")))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART)
|| !strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE))
{
/* For Lineart and Halftone: */
/* Enable "threshold" */
@ -728,7 +728,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_CUSTOM_GAMMA].cap &= ~SANE_CAP_INACTIVE;
if (s->val[OPT_CUSTOM_GAMMA].w)
{
if (!strcmp (val, SANE_I18N("Color"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_COLOR)
|| !strcmp (val, SANE_I18N("Fine color")))
{
s->opt[OPT_CUSTOM_GAMMA_BIND].cap &= ~SANE_CAP_INACTIVE;
@ -934,9 +934,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = s->val[OPT_MODE].s;
if (!strcmp (mode, SANE_I18N("Gray")))
if (!strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY))
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (!strcmp (mode, SANE_I18N("Color"))
else if (!strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR)
|| !strcmp (mode, SANE_I18N("Fine color")))
{
s->opt[OPT_CUSTOM_GAMMA_BIND].cap &= ~SANE_CAP_INACTIVE;
@ -1057,8 +1057,8 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters *params)
}
mode = s->val[OPT_MODE].s;
if (!strcmp (mode, SANE_I18N("Lineart"))
|| !strcmp (mode, SANE_I18N("Halftone")))
if (!strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART)
|| !strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE))
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line / 8;
@ -1066,13 +1066,13 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters *params)
s->params.pixels_per_line = s->params.bytes_per_line * 8;
s->params.depth = 1;
}
else if (!strcmp (mode, SANE_I18N("Gray")))
else if (!strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY))
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
s->params.depth = 8;
}
else if (!strcmp (mode, SANE_I18N("Color"))
else if (!strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR)
|| !strcmp (mode, SANE_I18N("Fine color")))
{
s->params.format = SANE_FRAME_RGB;
@ -1266,8 +1266,8 @@ sane_start (SANE_Handle handle)
if (s->hw->info.model != CS2700 && s->hw->info.model != FS2710)
{
if (!strcmp (mode_str, SANE_I18N("Lineart"))
|| !strcmp (mode_str, SANE_I18N("Halftone")))
if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART)
|| !strcmp (mode_str, SANE_VALUE_SCAN_MODE_HALFTONE))
s->RIF = s->val[OPT_HNEGATIVE].w;
else
s->RIF = !s->val[OPT_HNEGATIVE].w;
@ -1299,22 +1299,22 @@ sane_start (SANE_Handle handle)
s->ShadowB = s->val[OPT_SHADOW_B].w;
}
if (!strcmp (mode_str, SANE_I18N("Lineart")))
if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART))
{
mode = 4;
s->image_composition = 0;
}
else if (!strcmp (mode_str, SANE_I18N("Halftone")))
else if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_HALFTONE))
{
mode = 4;
s->image_composition = 1;
}
else if (!strcmp (mode_str, SANE_I18N("Gray")))
else if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_GRAY))
{
mode = 5;
s->image_composition = 2;
}
else if (!strcmp (mode_str, SANE_I18N("Color"))
else if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_COLOR)
|| !strcmp (mode_str, SANE_I18N("Fine color")))
{
mode = 6;
@ -1395,7 +1395,7 @@ sane_start (SANE_Handle handle)
#if 0
wbuf[34] = (((600 < s->val[OPT_X_RESOLUTION].w)
|| (600 < s->val[OPT_Y_RESOLUTION].w))
&& (strcmp (s->val[OPT_MODE].s, SANE_I18N("Lineart")) != 0))
&& (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) != 0))
? 12 : s->bpp;
#endif
wbuf[36] = 0;
@ -1620,7 +1620,7 @@ sane_start (SANE_Handle handle)
s->bytes_to_read = s->params.bytes_per_line * s->params.lines;
mode_str = s->val[OPT_MODE].s;
if (!strcmp (mode_str, SANE_I18N("Lineart")))
if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART))
{
if (((600 < s->val[OPT_X_RESOLUTION].w)
|| (600 < s->val[OPT_Y_RESOLUTION].w)))
@ -1630,9 +1630,9 @@ sane_start (SANE_Handle handle)
}
s->params.pixels_per_line = s->params.bytes_per_line * 8;
}
else if (!strcmp (mode_str, SANE_I18N("Gray")))
else if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_GRAY))
s->params.pixels_per_line = s->params.bytes_per_line;
else if (!strcmp (mode_str, SANE_I18N("Color"))
else if (!strcmp (mode_str, SANE_VALUE_SCAN_MODE_COLOR)
|| !strcmp (mode_str, SANE_I18N("Fine color")))
s->params.pixels_per_line = s->params.bytes_per_line / 3;
else
@ -1737,7 +1737,7 @@ read_fs2710 (SANE_Handle handle, SANE_Byte *buf, SANE_Int max_len,
set up an intermediate buffer which is twice as large
as buf, and then map this buffer to buf. */
if (!strcmp (s->val[OPT_MODE].s, SANE_I18N("Color")))
if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR))
{
if (max_len > s->auxbuf_len)
{ /* extend buffer? */
@ -2054,7 +2054,7 @@ SANE_Int *len)
secondimage = s->inbuffer;
if (!strcmp (s->val[OPT_MODE].s, SANE_I18N("Color")))
if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR))
{
maxpix = pixel_per_line / 2;
for (pix = 0; (int) pix < maxpix; pix++)
@ -2067,7 +2067,7 @@ SANE_Int *len)
s->outbuffer[6 * pix + 5] = firstimage[3 * pix + 2];
}
}
else if (!strcmp (s->val[OPT_MODE].s, SANE_I18N("Gray")))
else if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY))
{
for (pix = 0; pix < pixel_per_line / 2; pix++)
{

Wyświetl plik

@ -136,24 +136,33 @@ static CANON_Device *first_dev = NULL;
static CANON_Scanner *first_handle = NULL;
static const SANE_String_Const mode_list[] = {
SANE_I18N(SANE_I18N("Lineart")), SANE_I18N("Halftone"), SANE_I18N("Gray"),
SANE_I18N("Color"), 0
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
/* modification for FS2710 */
static const SANE_String_Const mode_list_fs2710[] = {
SANE_I18N("Color"), SANE_I18N("Raw"), 0
SANE_VALUE_SCAN_MODE_COLOR,
SANE_I18N("Raw"), 0
};
/* modification for FB620S */
static const SANE_String_Const mode_list_fb620[] = {
SANE_I18N("Lineart"), SANE_I18N("Gray"), SANE_I18N("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
SANE_I18N("Fine color"), 0
};
/* modification for FB1200S */
static const SANE_String_Const mode_list_fb1200[] = {
SANE_I18N("Lineart"), SANE_I18N("Gray"), SANE_I18N("Color"), 0
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
static const SANE_String_Const tpu_dc_mode_list[] = {
@ -564,7 +573,7 @@ do_gamma (CANON_Scanner * s)
strcmp (filmtype_list[1], s->val[OPT_NEGATIVE].s)
: s->val[OPT_HNEGATIVE].w;
if (!strcmp (s->val[OPT_MODE].s, SANE_I18N("Gray")))
if (!strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY))
{
/* If scanning in gray mode, use the first curve for the
scanner's monochrome gamma component */

Wyświetl plik

@ -321,10 +321,10 @@
#define STRING_ADFBACK SANE_I18N("ADF Back")
#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex")
#define STRING_LINEART SANE_I18N("Lineart")
#define STRING_HALFTONE SANE_I18N("Halftone")
#define STRING_GRAYSCALE SANE_I18N("Gray")
#define STRING_COLOR SANE_I18N("Color")
#define STRING_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define STRING_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define STRING_GRAYSCALE SANE_VALUE_SCAN_MODE_GRAY
#define STRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
#define STRING_RED SANE_I18N("Red")
#define STRING_GREEN SANE_I18N("Green")

Wyświetl plik

@ -240,8 +240,8 @@ int global_has_cal_buffer = 1;
int global_lines_per_block = 16;
/* ------------------------------------------------------------------------- */
#define STRING_GRAYSCALE SANE_I18N("Gray")
#define STRING_COLOR SANE_I18N("Color")
#define STRING_GRAYSCALE SANE_VALUE_SCAN_MODE_GRAY
#define STRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
/*
* used by attach* and sane_get_devices

Wyświetl plik

@ -1890,8 +1890,8 @@ static SANE_String_Const type_list[] =
0
};
static const char colorStr[] = "Color";
static const char grayStr[] = "Gray";
static const char colorStr[] = SANE_VALUE_SCAN_MODE_COLOR;
static const char grayStr[] = SANE_VALUE_SCAN_MODE_GRAY;
static const char rgbiStr[] = "RGBI";
static const char iredStr[] = "Infrared";

Wyświetl plik

@ -205,9 +205,9 @@ static float white_factor[3] = {1.0, 0.93, 0.98}; /* Blue, Red, Green */
#define STRING_ADFBACK SANE_I18N("ADF Back")
#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex")
#define STRING_LINEART SANE_I18N("Lineart")
#define STRING_GRAYSCALE SANE_I18N("Gray")
#define STRING_COLOR SANE_I18N("Color")
#define STRING_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define STRING_GRAYSCALE SANE_VALUE_SCAN_MODE_GRAY
#define STRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
/*
* used by attach* and sane_get_devices

Wyświetl plik

@ -481,9 +481,9 @@ static struct mode_param mode_params[] = {
};
static const SANE_String_Const mode_list[] = {
SANE_I18N ("Binary"),
SANE_I18N ("Gray"),
SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
NULL
};

Wyświetl plik

@ -90,9 +90,9 @@ struct mode_param mode_params[] = {
};
static SANE_String_Const mode_list[] = {
SANE_I18N("Binary"),
SANE_I18N("Gray"),
SANE_I18N("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
#ifdef SANE_FRAME_IR
SANE_I18N("Infrared"),
#endif

Wyświetl plik

@ -517,10 +517,10 @@
#define STRING_ADFBACK SANE_I18N("ADF Back")
#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex")
#define STRING_LINEART SANE_I18N("Lineart")
#define STRING_HALFTONE SANE_I18N("Halftone")
#define STRING_GRAYSCALE SANE_I18N("Gray")
#define STRING_COLOR SANE_I18N("Color")
#define STRING_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define STRING_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define STRING_GRAYSCALE SANE_VALUE_SCAN_MODE_GRAY
#define STRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
#define STRING_DEFAULT SANE_I18N("Default")
#define STRING_ON SANE_I18N("On")

Wyświetl plik

@ -2924,10 +2924,10 @@ static const struct hp_option_descriptor_s PREVIEW_MODE[1] = {{
}};
static const struct hp_choice_s _scanmode_choices[] = {
{ HP_SCANMODE_LINEART, SANE_I18N("Lineart"), 0, 0, 0 },
{ HP_SCANMODE_HALFTONE, SANE_I18N("Halftone"), 0, 0, 0 },
{ HP_SCANMODE_GRAYSCALE, SANE_I18N("Grayscale"), 0, 0, 0 },
{ HP_SCANMODE_COLOR, SANE_I18N("Color"), 0, 0, 0 },
{ HP_SCANMODE_LINEART, SANE_VALUE_SCAN_MODE_LINEART, 0, 0, 0 },
{ HP_SCANMODE_HALFTONE, SANE_VALUE_SCAN_MODE_HALFTONE, 0, 0, 0 },
{ HP_SCANMODE_GRAYSCALE, SANE_VALUE_SCAN_MODE_GRAY, 0, 0, 0 },
{ HP_SCANMODE_COLOR, SANE_VALUE_SCAN_MODE_COLOR, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
static const struct hp_option_descriptor_s SCAN_MODE[1] = {{

Wyświetl plik

@ -378,7 +378,7 @@ bknd_colormodes (TScanner * scanner, SANE_Int model)
/* at this moment all devices use the same list */
SANE_String_Const mycolormode[] =
{ SANE_I18N ("Color"), SANE_I18N ("Gray"), SANE_I18N ("Lineart"), 0 };
{ SANE_VALUE_SCAN_MODE_COLOR, SANE_VALUE_SCAN_MODE_GRAY, SANE_VALUE_SCAN_MODE_LINEART, 0 };
/* silence gcc */
model = model;
@ -1031,11 +1031,11 @@ Get_Colormode (SANE_String colormode)
{
SANE_Int rst;
if (strcmp (colormode, SANE_I18N ("Color")) == 0)
if (strcmp (colormode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
rst = CM_COLOR;
else if (strcmp (colormode, SANE_I18N ("Gray")) == 0)
else if (strcmp (colormode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
rst = CM_GRAY;
else if (strcmp (colormode, SANE_I18N ("Lineart")) == 0)
else if (strcmp (colormode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
rst = CM_LINEART;
else
rst = CM_COLOR; /* default */

Wyświetl plik

@ -85,7 +85,7 @@ res_list[] = { 6, 100, 200, 300, 600, 1200, 2400 };
#define SANE_VALUE_SCAN_SOURCE_TMA_SLIDES SANE_I18N("TMA Slides")
#define SANE_VALUE_SCAN_SOURCE_TMA_NEGATIVES SANE_I18N("TMA Negatives")
#define SANE_VALUE_SCAN_MODE_COLOR_24 SANE_I18N("Color")
#define SANE_VALUE_SCAN_MODE_COLOR_24 SANE_VALUE_SCAN_MODE_COLOR
#define SANE_VALUE_SCAN_MODE_COLOR_48 SANE_I18N("Color (48 bits)")
#define SANE_NAME_LAMP_TIMEOUT "extend-lamp-timeout"

Wyświetl plik

@ -128,8 +128,8 @@ static SANE_Range range_y = { 0, MAX_Y_S, 0 };
static SANE_Range range_br_cont = { BR_CONT_MIN, BR_CONT_MAX, 0 };
static const SANE_String_Const mode_list[] = {
"Gray",
"Color",
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
NULL
};

Wyświetl plik

@ -2609,7 +2609,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
s->params.pixels_per_line = s->params.bytes_per_line * 8;
s->params.depth = 1;
}
else /* if (strcmp (mode, "Gray") == 0) */
else /* if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0) */
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;

Wyświetl plik

@ -299,11 +299,11 @@ static const SANE_Range u16_range = {
0 /* quantization */
};
#define SM_LINEART "Lineart B/W"
#define SM_HALFTONE "Halftone"
#define SM_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define SM_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define SM_DITHER "Dither"
#define SM_ERRORDIFFUSION "Error Diffusion"
#define SM_COLOR "Color"
#define SM_COLOR SANE_VALUE_SCAN_MODE_COLOR
#define SM_4BITGRAY "4-Bit Gray"
#define SM_6BITGRAY "6-Bit Gray"
#define SM_8BITGRAY "8-Bit Gray"

Wyświetl plik

@ -899,8 +899,8 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
}
mode = s->val[OPT_MODE].s;
if ((strcmp (mode, "Lineart") == 0) ||
(strcmp (mode, "Halftone")) == 0)
if ((strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0) ||
(strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE)) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line / 8;
@ -908,7 +908,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
s->params.pixels_per_line = s->params.bytes_per_line * 8;
s->params.depth = 1;
}
else /* if (strcmp (mode, "Gray") == 0) */
else /* if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0) */
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
@ -966,15 +966,15 @@ sane_start (SANE_Handle handle)
s->brightness = s->val[OPT_BRIGHTNESS].w;
s->contrast = s->val[OPT_CONTRAST].w;
s->bpp = s->params.depth;
if (strcmp (mode_str, "Lineart") == 0)
if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->image_composition = IBM_BINARY_MONOCHROME;
}
else if (strcmp (mode_str, "Halftone") == 0)
else if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
s->image_composition = IBM_DITHERED_MONOCHROME;
}
else if (strcmp (mode_str, "Gray") == 0)
else if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
s->image_composition = IBM_GRAYSCALE;
}

Wyświetl plik

@ -80,7 +80,9 @@
static const SANE_String_Const mode_list[] =
{
"Lineart", "Halftone", "Gray",
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
0
};

Wyświetl plik

@ -136,10 +136,10 @@
#define STRING_ADFBACK SANE_I18N("ADF Back")
#define STRING_ADFDUPLEX SANE_I18N("ADF Duplex")
#define STRING_LINEART SANE_I18N("Lineart")
#define STRING_HALFTONE SANE_I18N("Halftone")
#define STRING_GRAYSCALE SANE_I18N("Gray")
#define STRING_COLOR SANE_I18N("Color")
#define STRING_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define STRING_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define STRING_GRAYSCALE SANE_VALUE_SCAN_MODE_GRAY
#define STRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
/* Also set via config file. */
static int global_buffer_size = DEFAULT_BUFFER_SIZE;

Wyświetl plik

@ -256,9 +256,9 @@ struct scanners_supported
/*--------------------------------------------------------------------------*/
#define BLACK_WHITE_STR SANE_I18N("Black & White")
#define GRAY_STR SANE_I18N("Grayscale")
#define COLOR_STR SANE_I18N("Color")
#define BLACK_WHITE_STR SANE_VALUE_SCAN_MODE_LINEART
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
/*--------------------------------------------------------------------------*/

Wyświetl plik

@ -98,7 +98,9 @@ static SANE_Int new_dev_len;
static SANE_Int new_dev_alloced;
static SANE_String_Const mode_list[] = {
SANE_I18N ("Lineart"), SANE_I18N ("Gray"), SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -732,7 +734,7 @@ set_window (Ma1509_Scanner * s)
height = (SANE_UNFIX (s->val[OPT_BR_Y].w) - SANE_UNFIX (s->val[OPT_TL_Y].w))
* pixels_per_mm + 0.5 + offset;
if (strcmp (s->val[OPT_MODE].s, "Lineart") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
width /= 64;
width *= 64;
@ -772,7 +774,7 @@ set_window (Ma1509_Scanner * s)
*cp++ = 0x00; /* brightness, not impl. */
/* threshold */
if (strcmp (s->val[OPT_MODE].s, "Lineart") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
*cp++ = (SANE_Byte) s->val[OPT_THRESHOLD].w;
else
*cp++ = 0x80;
@ -781,12 +783,12 @@ set_window (Ma1509_Scanner * s)
/* Note that 'image composition' has no meaning for the SE series */
/* Mode selection is accomplished solely by bits/pixel (1, 8, 24) */
if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
*cp++ = 24; /* 24 bits/pixel in color mode */
s->hw->bpl *= 3;
}
else if (strcmp (s->val[OPT_MODE].s, "Gray") == 0)
else if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) == 0)
*cp++ = 8; /* 8 bits/pixel in gray mode */
else
{
@ -796,7 +798,7 @@ set_window (Ma1509_Scanner * s)
cp += 13; /* skip reserved bytes */
*cp++ = 0x00; /* lamp mode */
if (strcmp (s->val[OPT_MODE].s, "Lineart") != 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) != 0)
*cp++ = 0x02; /* ??? */
status = ma1509_cmd (s, scsi_set_window, buffer, &size);
@ -1048,7 +1050,7 @@ start_read_data (Ma1509_Scanner * s)
SANE_Status status;
SANE_Int total_size = s->hw->ppl * s->hw->lines;
if (strcmp (s->val[OPT_MODE].s, "Lineart") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
total_size /= 8;
memset (cmd, 0, 8);
@ -1593,7 +1595,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_CUSTOM_GAMMA].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
if (strcmp (s->val[option].s, "Lineart") == 0)
if (strcmp (s->val[option].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
}
@ -1651,7 +1653,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE;
if (w && strcmp (s->val[OPT_MODE].s, "Lineart") != 0)
if (w && strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) != 0)
{
s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE;
@ -1698,13 +1700,13 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
s->params.lines = height * dots_per_mm;
}
mode = s->val[OPT_MODE].s;
if (strcmp (mode, "Lineart") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = (s->params.pixels_per_line + 7) / 8;
s->params.depth = 1;
}
else if (strcmp (mode, "Gray") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
@ -1795,7 +1797,7 @@ sane_start (SANE_Handle handle)
goto stop_scanner_and_return;
}
if (strcmp (s->val[OPT_MODE].s, "Lineart") != 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) != 0)
{
status = calibration (s);
if (status != SANE_STATUS_GOOD)
@ -1835,9 +1837,9 @@ sane_start (SANE_Handle handle)
s->params.bytes_per_line = s->hw->bpl;
s->params.pixels_per_line = s->params.bytes_per_line;
if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
s->params.pixels_per_line /= 3;
else if (strcmp (s->val[OPT_MODE].s, "Lineart") == 0)
else if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
s->params.pixels_per_line *= 8;
s->params.lines = s->hw->lines;
@ -1935,7 +1937,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
s->read_bytes += (*len);
/* invert for lineart mode */
if (strcmp (s->val[OPT_MODE].s, "Lineart") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
for (i = 0; i < *len; i++)
buf[i] = ~buf[i];

Wyświetl plik

@ -205,7 +205,7 @@ enum Matsushita_Option
/*--------------------------------------------------------------------------*/
#define BLACK_WHITE_STR SANE_I18N("Black & White")
#define BLACK_WHITE_STR SANE_VALUE_SCAN_MODE_LINEART
#define GRAY4_STR SANE_I18N("Grayscale 4 bits")
#define GRAY8_STR SANE_I18N("Grayscale 8 bits")

Wyświetl plik

@ -104,10 +104,10 @@ static SANE_Bool inhibit_real_calib = SANE_FALSE;
#define M_GSS_WAIT 5 /* seconds */
#define M_LINEART "LineArt"
#define M_HALFTONE "Halftone"
#define M_GRAY "Gray"
#define M_COLOR "Color"
#define M_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define M_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define M_GRAY SANE_VALUE_SCAN_MODE_GRAY
#define M_COLOR SANE_VALUE_SCAN_MODE_COLOR
#define M_OPAQUE "Opaque/Normal"
#define M_TRANS "Transparency"

Wyświetl plik

@ -941,10 +941,10 @@ typedef struct Microtek2_Device {
#define MD_MODESTRING_NUMS 4
#define MD_MODESTRING_COLOR "Color"
#define MD_MODESTRING_GRAY "Gray"
#define MD_MODESTRING_HALFTONE "Halftone"
#define MD_MODESTRING_LINEART "LineArt"
#define MD_MODESTRING_COLOR SANE_VALUE_SCAN_MODE_COLOR
#define MD_MODESTRING_GRAY SANE_VALUE_SCAN_MODE_GRAY
#define MD_MODESTRING_HALFTONE SANE_VALUE_SCAN_MODE_HALFTONE
#define MD_MODESTRING_LINEART SANE_VALUE_SCAN_MODE_LINEART
SANE_String_Const scanmode_list[MD_MODESTRING_NUMS + 1];
#define MD_DEPTHVAL_NUMS 6

Wyświetl plik

@ -126,12 +126,16 @@ static const SANE_Int color_seq[] = {
/* Which modes are supported? */
static SANE_String_Const mode_list_paragon[] = {
SANE_I18N ("Lineart"), SANE_I18N ("Halftone"), SANE_I18N ("Gray"),
SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
static SANE_String_Const mode_list_se[] = {
SANE_I18N ("Lineart"), SANE_I18N ("Gray"), SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -5944,16 +5948,16 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
SANE_String_Const mode = s->val[OPT_MODE].s;
if (strcmp (mode, "Gray") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_B].cap &= ~SANE_CAP_INACTIVE;
}
else if ((strcmp (mode, "Lineart") == 0)
else if ((strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
&& (s->hw->flags & MUSTEK_FLAG_PRO))
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
@ -6002,8 +6006,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_HALFTONE_DIMENSION].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_HALFTONE_PATTERN].cap |= SANE_CAP_INACTIVE;
halftoning = strcmp (val, "Halftone") == 0;
binary = (halftoning || strcmp (val, "Lineart") == 0);
halftoning = strcmp (val, SANE_VALUE_SCAN_MODE_HALFTONE) == 0;
binary = (halftoning || strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0);
if (binary)
{
@ -6037,7 +6041,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (s->hw->flags & MUSTEK_FLAG_THREE_PASS)
{
if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
s->opt[OPT_BRIGHTNESS_R].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_BRIGHTNESS_G].cap &= ~SANE_CAP_INACTIVE;
@ -6054,18 +6058,18 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
}
else if (s->hw->flags & MUSTEK_FLAG_PRO)
{
if (strcmp (s->val[OPT_MODE].s, "Gray") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->opt[OPT_FAST_GRAY_MODE].cap &= ~SANE_CAP_INACTIVE;
else
s->opt[OPT_FAST_GRAY_MODE].cap |= SANE_CAP_INACTIVE;
if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
s->opt[OPT_BIT_DEPTH].cap &= ~SANE_CAP_INACTIVE;
else
s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE;
}
else if (s->hw->flags & MUSTEK_FLAG_SE_PLUS)
{
if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
s->opt[OPT_BIT_DEPTH].cap &= ~SANE_CAP_INACTIVE;
else
s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE;
@ -6073,9 +6077,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (s->val[OPT_CUSTOM_GAMMA].w)
{
if (strcmp (val, "Gray") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -6175,13 +6179,13 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
}
encode_halftone (s);
mode = s->val[OPT_MODE].s;
if (strcmp (mode, "Lineart") == 0 || strcmp (mode, "Halftone") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0 || strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = (s->params.pixels_per_line + 7) / 8;
s->params.depth = 1;
}
else if (strcmp (mode, "Gray") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
@ -6282,13 +6286,13 @@ sane_start (SANE_Handle handle)
s->start_time = start.tv_sec;
/* translate options into s->mode for convenient access: */
mode = s->val[OPT_MODE].s;
if (strcmp (mode, "Lineart") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
s->mode = MUSTEK_MODE_LINEART;
else if (strcmp (mode, "Halftone") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
s->mode = MUSTEK_MODE_HALFTONE;
else if (strcmp (mode, "Gray") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->mode = MUSTEK_MODE_GRAY;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
s->mode = MUSTEK_MODE_COLOR;
/* scanner dependant specials */

Wyświetl plik

@ -118,7 +118,7 @@ static SANE_Device **devarray = NULL;
/* currently active Handles */
static Mustek_pp_Handle *first_hndl = NULL;
static SANE_String_Const mustek_pp_modes[4] = {"Lineart", "Grayscale", "Color", NULL};
static SANE_String_Const mustek_pp_modes[4] = {SANE_VALUE_SCAN_MODE_LINEART, SANE_VALUE_SCAN_MODE_GRAY, SANE_VALUE_SCAN_MODE_COLOR, NULL};
static SANE_Word mustek_pp_modes_size = 10;
static SANE_String_Const mustek_pp_speeds[6] = {"Slowest", "Slower", "Normal", "Faster", "Fastest", NULL};
@ -1443,9 +1443,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = hndl->val[OPT_MODE].s;
if (strcmp (mode, "Grayscale") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
hndl->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
hndl->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
hndl->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -1488,20 +1488,20 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
hndl->opt[OPT_DEPTH].cap |= SANE_CAP_INACTIVE;
if ((hndl->dev->caps & CAP_DEPTH) && (strcmp(val, "Color") == 0))
if ((hndl->dev->caps & CAP_DEPTH) && (strcmp(val, SANE_VALUE_SCAN_MODE_COLOR) == 0))
hndl->opt[OPT_DEPTH].cap &= ~SANE_CAP_INACTIVE;
if (!(hndl->dev->caps & CAP_GAMMA_CORRECT))
return SANE_STATUS_GOOD;
if (strcmp (val, "Lineart") != 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) != 0)
hndl->opt[OPT_CUSTOM_GAMMA].cap &= ~SANE_CAP_INACTIVE;
if (hndl->val[OPT_CUSTOM_GAMMA].w == SANE_TRUE)
{
if (strcmp (val, "Grayscale") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
hndl->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
hndl->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
hndl->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -1610,9 +1610,9 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
mode = hndl->val[OPT_MODE].s;
if (strcmp (mode, "Lineart") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
hndl->mode = MODE_BW;
else if (strcmp (mode, "Grayscale") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
hndl->mode = MODE_GRAYSCALE;
else
hndl->mode = MODE_COLOR;

Wyświetl plik

@ -139,21 +139,21 @@ calc_parameters (Mustek_Usb_Scanner * s)
s->params.last_frame = SANE_TRUE;
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
{
s->params.format = SANE_FRAME_GRAY;
s->params.depth = 1;
s->bpp = 1;
s->channels = 1;
}
else if (!strcmp (val, "Gray"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_GRAY))
{
s->params.format = SANE_FRAME_GRAY;
s->params.depth = 8;
s->bpp = 8;
s->channels = 1;
}
else if (!strcmp (val, "Color"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_COLOR))
{
s->params.format = SANE_FRAME_RGB;
s->params.depth = 8;
@ -191,7 +191,7 @@ calc_parameters (Mustek_Usb_Scanner * s)
s->width_dots = max_x;
if (s->height_dots > max_y)
s->height_dots = max_y;
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
{
s->width_dots = (s->width_dots / 8) * 8;
if (s->width_dots == 0)
@ -265,9 +265,9 @@ init_options (Mustek_Usb_Scanner * s)
s->opt[OPT_MODE_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
/* scan mode */
mode_list[0] = SANE_I18N ("Color");
mode_list[1] = SANE_I18N ("Gray");
mode_list[2] = SANE_I18N ("Lineart");
mode_list[0] = SANE_VALUE_SCAN_MODE_COLOR;
mode_list[1] = SANE_VALUE_SCAN_MODE_GRAY;
mode_list[2] = SANE_VALUE_SCAN_MODE_LINEART;
mode_list[3] = NULL;
s->opt[OPT_MODE].name = SANE_NAME_SCAN_MODE;
@ -1296,9 +1296,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->green_table = s->green_gamma_table;
s->blue_table = s->blue_gamma_table;
s->gray_table = s->gray_gamma_table;
if (strcmp (s->val[OPT_MODE].s, "Gray") == 0)
if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (s->val[OPT_MODE].s, "Color") == 0)
else if (strcmp (s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -1332,7 +1332,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE;
if (strcmp (val, "Lineart") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
}
@ -1415,9 +1415,9 @@ sane_start (SANE_Handle handle)
val = s->val[OPT_MODE].s;
if (!strcmp (val, "Lineart"))
if (!strcmp (val, SANE_VALUE_SCAN_MODE_LINEART))
color_mode = GRAY8;
else if (!strcmp (val, "Gray"))
else if (!strcmp (val, SANE_VALUE_SCAN_MODE_GRAY))
color_mode = GRAY8;
else /* Color */
color_mode = RGB24;

Wyświetl plik

@ -106,7 +106,7 @@ static SANE_String_Const mode_list[] = {
SANE_I18N ("Color24"),
SANE_I18N ("Gray16"),
SANE_I18N ("Gray8"),
SANE_I18N ("Lineart"),
SANE_VALUE_SCAN_MODE_LINEART,
0
};
@ -234,7 +234,7 @@ calc_parameters (Mustek_Scanner * s)
s->params.depth = 8;
s->setpara.smScanMode = SM_GRAY;
}
else if (strcmp (val, "Lineart") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.depth = 1;
@ -2280,7 +2280,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (s->val[option].s)
free (s->val[option].s);
s->val[option].s = strdup (val);
if (strcmp (s->val[option].s, "Lineart") == 0)
if (strcmp (s->val[option].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
ENABLE (OPT_THRESHOLD);
}

Wyświetl plik

@ -152,10 +152,10 @@ typedef enum
}
Modes;
#define M_LINEART "Lineart"
#define M_GRAY "Gray"
#define M_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define M_GRAY SANE_VALUE_SCAN_MODE_GRAY
#define M_LINEART_COLOR "Lineart Color"
#define M_COLOR "Color"
#define M_COLOR SANE_VALUE_SCAN_MODE_COLOR
static const SANE_String_Const mode_list[] =
{
#if 0

Wyświetl plik

@ -200,9 +200,9 @@ static const SANE_Range rangeXmm = { 0, 220, 1 };
static const SANE_Range rangeYmm = { 0, 297, 1 };
static const SANE_Int startUpGamma = SANE_FIX (1.6);
static const char colorStr[] = { "Color" };
static const char grayStr[] = { "Gray" };
static const char lineartStr[] = { "Lineart" };
static const char colorStr[] = { SANE_VALUE_SCAN_MODE_COLOR };
static const char grayStr[] = { SANE_VALUE_SCAN_MODE_GRAY };
static const char lineartStr[] = { SANE_VALUE_SCAN_MODE_LINEART };
#define DEPTH_LINEART 1
#define DEPTH_GRAY 8

Wyświetl plik

@ -116,10 +116,10 @@
#define PIE_CONFIG_FILE "pie.conf"
#define LINEART_STR "Lineart"
#define HALFTONE_STR "Halftone"
#define GRAY_STR "Gray"
#define COLOR_STR "Color"
#define LINEART_STR SANE_VALUE_SCAN_MODE_LINEART
#define HALFTONE_STR SANE_VALUE_SCAN_MODE_HALFTONE
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
#define LINEART 1
#define HALFTONE 2

Wyświetl plik

@ -221,10 +221,10 @@ attach (const char *devname, PINT_Device **devp)
if (ioctl (fd, SCIOCSET, &scanio) >= 0) \
mode_list[lastguess ++] = modename
CHECK_MODE(SIM_BINARY_MONOCHROME, "Lineart");
CHECK_MODE(SIM_DITHERED_MONOCHROME, "Halftone");
CHECK_MODE(SIM_GRAYSCALE, "Gray");
CHECK_MODE(SIM_COLOR, "Color");
CHECK_MODE(SIM_BINARY_MONOCHROME, SANE_VALUE_SCAN_MODE_LINEART);
CHECK_MODE(SIM_DITHERED_MONOCHROME, SANE_VALUE_SCAN_MODE_HALFTONE);
CHECK_MODE(SIM_GRAYSCALE, SANE_VALUE_SCAN_MODE_GRAY);
CHECK_MODE(SIM_COLOR, SANE_VALUE_SCAN_MODE_COLOR);
CHECK_MODE(SIM_RED, "Red");
CHECK_MODE(SIM_GREEN, "Green");
CHECK_MODE(SIM_BLUE, "Blue");
@ -859,17 +859,17 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters *params)
/* set the scan image mode */
mode = s->val[OPT_MODE].s;
if (!strcmp (mode, "Lineart"))
if (!strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART))
{
s->params.format = SANE_FRAME_GRAY;
scanio.scan_image_mode = SIM_BINARY_MONOCHROME;
}
else if (!strcmp (mode, "Halftone"))
else if (!strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE))
{
s->params.format = SANE_FRAME_GRAY;
scanio.scan_image_mode = SIM_DITHERED_MONOCHROME;
}
else if (!strcmp (mode, "Gray"))
else if (!strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY))
{
s->params.format = SANE_FRAME_GRAY;
scanio.scan_image_mode = SIM_GRAYSCALE;

Wyświetl plik

@ -647,10 +647,10 @@ init_option_descriptors (pixma_sane_t * ss)
* because the whole pixma_sane_t was cleared during allocation. */
/* setup available mode. */
ss->mode_list[0] = SANE_I18N ("Color");
ss->mode_list[0] = SANE_VALUE_SCAN_MODE_COLOR;
if (cfg->cap & PIXMA_CAP_GRAY)
{
ss->mode_list[1] = SANE_I18N ("Gray");
ss->mode_list[1] = SANE_VALUE_SCAN_MODE_GRAY;
}
/* setup paper source */

Wyświetl plik

@ -67,7 +67,7 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->constraint_type = SANE_CONSTRAINT_STRING_LIST;
sod->constraint.string_list = ss->mode_list;
OPT_IN_CTX[opt_mode].info = SANE_INFO_RELOAD_PARAMS;
opt->def.s = SANE_I18N ("Color");
opt->def.s = SANE_VALUE_SCAN_MODE_COLOR;
opt->val.w = find_string_in_list (opt->def.s, sod->constraint.string_list);
opt = &(OPT_IN_CTX[opt_source]);

Wyświetl plik

@ -179,7 +179,7 @@ static ModeParam mode_9800x_params[] =
static const SANE_String_Const mode_list[] =
{
SANE_VALUE_SCAN_MODE_LINEART,
SANE_I18N("Halftone"),
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
NULL
@ -188,7 +188,7 @@ static const SANE_String_Const mode_list[] =
static const SANE_String_Const mode_9800x_list[] =
{
SANE_VALUE_SCAN_MODE_LINEART,
SANE_I18N("Halftone"),
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
SANE_I18N("Color36"),

Wyświetl plik

@ -755,7 +755,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
}
mode = s->val[OPT_MODE].s;
if (strcmp (mode, "Lineart") == 0 || strcmp (mode, "Halftone") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0 || strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line / 8;
@ -763,7 +763,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
s->params.pixels_per_line = s->params.bytes_per_line * 8;
s->params.depth = 1;
}
else /* if (strcmp (mode, "Gray") == 0) */
else /* if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0) */
{
s->params.format = SANE_FRAME_GRAY;
s->params.bytes_per_line = s->params.pixels_per_line;
@ -819,15 +819,15 @@ sane_start (SANE_Handle handle)
s->brightness = s->val[OPT_BRIGHTNESS].w;
s->contrast = s->val[OPT_CONTRAST].w;
s->bpp = s->params.depth;
if (strcmp (mode_str, "Lineart") == 0)
if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_LINEART) == 0)
{
s->image_composition = RICOH_BINARY_MONOCHROME;
}
else if (strcmp (mode_str, "Halftone") == 0)
else if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
{
s->image_composition = RICOH_DITHERED_MONOCHROME;
}
else if (strcmp (mode_str, "Gray") == 0)
else if (strcmp (mode_str, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
s->image_composition = RICOH_GRAYSCALE;
}

Wyświetl plik

@ -69,7 +69,9 @@
static const SANE_String_Const mode_list[] =
{
"Lineart", "Halftone", "Gray",
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
0
};

Wyświetl plik

@ -151,9 +151,9 @@ static const SANE_Device **devlist = 0;
static SANE_String_Const mode_list[] = {
SANE_I18N (COLOR_MODE),
SANE_I18N (GRAY_MODE),
SANE_I18N (LINEART_MODE),
SANE_VALUE_SCAN_MODE_COLOR,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_LINEART,
0
};

Wyświetl plik

@ -54,9 +54,9 @@
#define SANE_I18N(text) text
#endif /* */
#define COLOR_MODE "Color"
#define GRAY_MODE "Gray"
#define LINEART_MODE "Lineart"
#define COLOR_MODE SANE_VALUE_SCAN_MODE_COLOR
#define GRAY_MODE SANE_VALUE_SCAN_MODE_GRAY
#define LINEART_MODE SANE_VALUE_SCAN_MODE_LINEART
/* preferred number of bytes to keep in buffer */
#define PREFERED_BUFFER_SIZE 2097152 /* all scanner memory */

Wyświetl plik

@ -285,10 +285,10 @@ struct scanners_supported
/*--------------------------------------------------------------------------*/
#define LINEART_STR SANE_I18N("Lineart")
#define HALFTONE_STR SANE_I18N("Halftone")
#define GRAY_STR SANE_I18N("Gray")
#define COLOR_STR SANE_I18N("Color")
#define LINEART_STR SANE_VALUE_SCAN_MODE_LINEART
#define HALFTONE_STR SANE_VALUE_SCAN_MODE_HALFTONE
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
/*--------------------------------------------------------------------------*/

Wyświetl plik

@ -180,10 +180,10 @@ typedef enum
}
Modes;
#define M_LINEART "Lineart"
#define M_GRAY "Gray"
#define M_LINEART_COLOR "Lineart Color"
#define M_COLOR "Color"
#define M_LINEART SANE_VALUE_SCAN_MODE_LINEART
#define M_GRAY SANE_VALUE_SCAN_MODE_GRAY
#define M_LINEART_COLOR SANE_VALUE_SCAN_MODE_COLOR_LINEART
#define M_COLOR SANE_VALUE_SCAN_MODE_COLOR
static const SANE_String_Const mode_list[] =
{
M_LINEART, M_GRAY, M_LINEART_COLOR, M_COLOR,

Wyświetl plik

@ -78,8 +78,10 @@ static SM3840_Scan *first_handle;
static const SANE_Device **devlist = 0;
static const SANE_String_Const mode_list[] = {
SANE_I18N ("Gray"), SANE_I18N ("Color"),
SANE_I18N ("Lineart"), SANE_I18N ("Halftone"),
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
0
};
@ -332,11 +334,11 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
memset (&s->sane_params, 0, sizeof (s->sane_params));
/* Copy from options to sm3840_params */
s->sm3840_params.gray =
(!strcasecmp (s->value[OPT_MODE].s, SANE_I18N ("Gray"))) ? 1 : 0;
(!strcasecmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY)) ? 1 : 0;
s->sm3840_params.halftone =
(!strcasecmp (s->value[OPT_MODE].s, SANE_I18N ("Halftone"))) ? 1 : 0;
(!strcasecmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_HALFTONE)) ? 1 : 0;
s->sm3840_params.lineart =
(!strcasecmp (s->value[OPT_MODE].s, SANE_I18N ("Lineart"))) ? 1 : 0;
(!strcasecmp (s->value[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART)) ? 1 : 0;
s->sm3840_params.dpi = s->value[OPT_RESOLUTION].w;
s->sm3840_params.bpp = s->value[OPT_BIT_DEPTH].w;

Wyświetl plik

@ -73,10 +73,10 @@ static SANE_Int def_bpp = 8;
static char md_auto[] = "Auto";
/* predefined scan mode names */
static char md_colour[] = SANE_I18N("Color");
static char md_bilevelcolour[] = SANE_I18N("Halftone");
static char md_greyscale[] = SANE_I18N("Gray");
static char md_lineart[] = SANE_I18N("Lineart");
static char md_colour[] = SANE_VALUE_SCAN_MODE_COLOR;
static char md_bilevelcolour[] = SANE_VALUE_SCAN_MODE_HALFTONE;
static char md_greyscale[] = SANE_VALUE_SCAN_MODE_GRAY;
static char md_lineart[] = SANE_VALUE_SCAN_MODE_LINEART;
/* predefined scan source names */
static char src_flatbed[] = SANE_I18N("Flatbed");

Wyświetl plik

@ -248,11 +248,11 @@ static const SANE_Int x_res_list[] =
static const SANE_Int y_res_list[] =
{11, 0, 60, 75, 80, 100, 120, 150, 200, 240, 300, 600};
static const char lineStr[] = "Lineart";
static const char halfStr[] = "Halftone";
static const char lineStr[] = SANE_VALUE_SCAN_MODE_LINEART;
static const char halfStr[] = SANE_VALUE_SCAN_MODE_HALFTONE;
static const char gray4Str[] = "4-bit Gray";
static const char gray8Str[] = "8-bit Gray";
static const char colorStr[] = "Color";
static const char colorStr[] = SANE_VALUE_SCAN_MODE_COLOR;
static SANE_String_Const scan_mode_list[] =
{lineStr, halfStr, gray4Str, gray8Str, colorStr, NULL};

Wyświetl plik

@ -83,7 +83,10 @@ static Tamarack_Scanner *first_handle;
static const SANE_String_Const mode_list[] =
{
"Thresholded", "Dithered", "Gray", "Color",
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_HALFTONE,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -1067,13 +1070,13 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
static int make_mode (char *mode)
{
if (strcmp (mode, "Thresholded") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0)
return THRESHOLDED;
if (strcmp (mode, "Dithered") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_HALFTONE) == 0)
return DITHERED;
else if (strcmp (mode, "Gray") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
return GREYSCALE;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
return TRUECOLOR;
return -1;
@ -1229,7 +1232,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
#endif
if (strcmp (val, "Thresholded") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0)
s->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
else {
s->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
@ -1240,9 +1243,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->opt[OPT_CUSTOM_GAMMA].cap &= ~SANE_CAP_INACTIVE;
if (s->val[OPT_CUSTOM_GAMMA].w) {
if (strcmp (val, "Gray") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (val, "Color") == 0) {
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0) {
s->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE;

Wyświetl plik

@ -287,9 +287,9 @@ struct scanners_supported
/*--------------------------------------------------------------------------*/
#define BLACK_WHITE_STR SANE_I18N("Black & White")
#define GRAY_STR SANE_I18N("Grayscale")
#define COLOR_STR SANE_I18N("Color")
#define BLACK_WHITE_STR SANE_VALUE_SCAN_MODE_LINEART
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
/*--------------------------------------------------------------------------*/

Wyświetl plik

@ -290,9 +290,9 @@ struct scanners_supported
/*--------------------------------------------------------------------------*/
#define BLACK_WHITE_STR SANE_I18N("Black & White")
#define GRAY_STR SANE_I18N("Grayscale")
#define COLOR_STR SANE_I18N("Color")
#define BLACK_WHITE_STR SANE_VALUE_SCAN_MODE_LINEART
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
/*--------------------------------------------------------------------------*/

Wyświetl plik

@ -123,7 +123,8 @@ static SANE_Range fixed_constraint_range = {
};
static SANE_String_Const mode_list[] = {
SANE_I18N ("Gray"), SANE_I18N ("Color"),
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
@ -201,7 +202,7 @@ static SANE_Fixed init_tl_y = SANE_FIX (0.0);
static SANE_Fixed init_br_x = SANE_FIX (80.0);
static SANE_Fixed init_br_y = SANE_FIX (100.0);
static SANE_Word init_resolution = 50;
static SANE_String init_mode = "Gray";
static SANE_String init_mode =SANE_VALUE_SCAN_MODE_GRAY;
static SANE_Word init_depth = 8;
static SANE_Bool init_hand_scanner = SANE_FALSE;
static SANE_Bool init_three_pass = SANE_FALSE;
@ -369,7 +370,7 @@ init_options (Test_Device * test_device)
od->unit = SANE_UNIT_NONE;
od->size = sizeof (SANE_Word);
od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
if (strcmp (init_mode, "Color") != 0)
if (strcmp (init_mode, SANE_VALUE_SCAN_MODE_COLOR) != 0)
od->cap |= SANE_CAP_INACTIVE;
od->constraint_type = SANE_CONSTRAINT_NONE;
od->constraint.range = 0;
@ -384,7 +385,7 @@ init_options (Test_Device * test_device)
od->unit = SANE_UNIT_NONE;
od->size = max_string_size (order_list);
od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
if (strcmp (init_mode, "Color") != 0)
if (strcmp (init_mode, SANE_VALUE_SCAN_MODE_COLOR) != 0)
od->cap |= SANE_CAP_INACTIVE;
if (!init_three_pass)
od->cap |= SANE_CAP_INACTIVE;
@ -2094,7 +2095,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
strcpy (test_device->val[option].s, (SANE_String) value);
myinfo |= SANE_INFO_RELOAD_PARAMS;
myinfo |= SANE_INFO_RELOAD_OPTIONS;
if (strcmp (test_device->val[option].s, "Color") == 0)
if (strcmp (test_device->val[option].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
test_device->opt[opt_three_pass].cap &= ~SANE_CAP_INACTIVE;
if (test_device->val[opt_three_pass].w == SANE_TRUE)
@ -2389,7 +2390,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
p->lines *= random_factor;
}
if (strcmp (mode, "Gray") == 0)
if (strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
{
p->format = SANE_FRAME_GRAY;
p->last_frame = SANE_TRUE;
@ -2500,12 +2501,12 @@ sane_start (SANE_Handle handle)
}
if (test_device->scanning
&& (test_device->val[opt_three_pass].w == SANE_FALSE
&& strcmp (test_device->val[opt_mode].s, "Color") == 0))
&& strcmp (test_device->val[opt_mode].s, SANE_VALUE_SCAN_MODE_COLOR) == 0))
{
DBG (1, "sane_start: already scanning\n");
return SANE_STATUS_INVAL;
}
if (strcmp (test_device->val[opt_mode].s, "Color") == 0
if (strcmp (test_device->val[opt_mode].s, SANE_VALUE_SCAN_MODE_COLOR) == 0
&& test_device->val[opt_three_pass].w == SANE_TRUE
&& test_device->pass > 2)
{
@ -2690,7 +2691,7 @@ sane_read (SANE_Handle handle, SANE_Byte * data,
return status;
}
test_device->eof = SANE_TRUE;
if (strcmp (test_device->val[opt_mode].s, "Color") == 0
if (strcmp (test_device->val[opt_mode].s, SANE_VALUE_SCAN_MODE_COLOR) == 0
&& test_device->val[opt_three_pass].w == SANE_TRUE)
{
test_device->pass++;

Wyświetl plik

@ -182,12 +182,12 @@ in ADF mode this is done often:
#define UTA_STR SANE_I18N("Transparency Adapter")
#define ADF_STR SANE_I18N("Automatic Document Feeder")
#define LINEART_STR SANE_I18N("Lineart")
#define HALFTONE_STR SANE_I18N("Halftone")
#define GRAY_STR SANE_I18N("Gray")
#define COLOR_LINEART_STR SANE_I18N("Color Lineart")
#define COLOR_HALFTONE_STR SANE_I18N("Color Halftone")
#define COLOR_STR SANE_I18N("Color")
#define LINEART_STR SANE_VALUE_SCAN_MODE_LINEART
#define HALFTONE_STR SANE_VALUE_SCAN_MODE_HALFTONE
#define GRAY_STR SANE_VALUE_SCAN_MODE_GRAY
#define COLOR_LINEART_STR SANE_VALUE_SCAN_MODE_COLOR_LINEART
#define COLOR_HALFTONE_STR SANE_VALUE_SCAN_MODE_COLOR_HALFTONE
#define COLOR_STR SANE_VALUE_SCAN_MODE_COLOR
/* ------------------------------------------------------------ DEFINITIONS -------------------------------- */

Wyświetl plik

@ -135,7 +135,10 @@ static SANE_Char astra[128];
static const SANE_String_Const mode_list[] = {
SANE_I18N ("Lineart"), SANE_I18N ("Grayscale"), SANE_I18N ("Color"), 0
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
0
};
static const SANE_Range u4_range = {
@ -1479,7 +1482,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
*info |= SANE_INFO_INEXACT;
DBG (16, "control_option: swapping Y coordinates\n");
}
if (strcmp (dev->val[OPT_MODE].s, "Color") == 0)
if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w));
if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi))
@ -1597,7 +1600,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
dev->val[OPT_BR_X].w = dev->val[OPT_BR_X].w & 0xFFFC;
}
/* corrects top y for offset */
if (strcmp (dev->val[OPT_MODE].s, "Color") == 0)
if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi))
{
@ -1624,10 +1627,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = dev->val[OPT_MODE].s;
if ((strcmp (mode, "Grayscale") == 0)
|| (strcmp (mode, "Lineart") == 0))
if ((strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0))
dev->opt[OPT_GRAY_OFFSET].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_GRAY_OFFSET].cap |= SANE_CAP_INACTIVE;
dev->opt[OPT_RED_OFFSET].cap &= ~SANE_CAP_INACTIVE;
@ -1661,10 +1664,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = dev->val[OPT_MODE].s;
if ((strcmp (mode, "Grayscale") == 0)
|| (strcmp (mode, "Lineart") == 0))
if ((strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0))
dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE;
dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE;
@ -1699,14 +1702,14 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{
const char *mode = dev->val[OPT_MODE].s;
if ((strcmp (mode, "Grayscale") == 0)
|| (strcmp (mode, "Lineart") == 0))
if ((strcmp (mode, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (mode, SANE_VALUE_SCAN_MODE_LINEART) == 0))
{
dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
sanei_umax_pp_gamma (NULL, dev->val[OPT_GAMMA_VECTOR].wa,
NULL);
}
else if (strcmp (mode, "Color") == 0)
else if (strcmp (mode, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
dev->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -1746,7 +1749,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
dev->val[option].s = strdup (val);
/* corrects top y for offset */
if (strcmp (val, "Color") == 0)
if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w));
if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi))
@ -1768,14 +1771,14 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (dev->val[OPT_CUSTOM_GAMMA].w == SANE_TRUE)
{
if ((strcmp (val, "Grayscale") == 0)
|| (strcmp (val, "Lineart") == 0))
if ((strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0))
{
dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
sanei_umax_pp_gamma (NULL, dev->val[OPT_GAMMA_VECTOR].wa,
NULL);
}
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE;
dev->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE;
@ -1796,10 +1799,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (dev->val[OPT_MANUAL_OFFSET].w == SANE_TRUE)
{
if ((strcmp (val, "Grayscale") == 0)
|| (strcmp (val, "Lineart") == 0))
if ((strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0))
dev->opt[OPT_GRAY_OFFSET].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_RED_OFFSET].cap &= ~SANE_CAP_INACTIVE;
dev->opt[OPT_GREEN_OFFSET].cap &= ~SANE_CAP_INACTIVE;
@ -1816,10 +1819,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE)
{
if ((strcmp (val, "Grayscale") == 0)
|| (strcmp (val, "Lineart") == 0))
if ((strcmp (val, SANE_VALUE_SCAN_MODE_GRAY) == 0)
|| (strcmp (val, SANE_VALUE_SCAN_MODE_LINEART) == 0))
dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE;
else if (strcmp (val, "Color") == 0)
else if (strcmp (val, SANE_VALUE_SCAN_MODE_COLOR) == 0)
{
dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE;
dev->opt[OPT_GREEN_GAIN].cap &= ~SANE_CAP_INACTIVE;
@ -1848,9 +1851,9 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
DBG (64, "sane_get_parameters\n");
/* color/gray */
if (strcmp (dev->val[OPT_MODE].s, "Color") != 0)
if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) != 0)
{
if (strcmp (dev->val[OPT_MODE].s, "Grayscale") != 0)
if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) != 0)
dev->color = UMAX_PP_MODE_LINEART;
else
dev->color = UMAX_PP_MODE_GRAYSCALE;

Wyświetl plik

@ -385,7 +385,10 @@ static int doc_source_to_code[] = {
};
static SANE_String_Const scan_modes[] = {
"Lineart", "Halftone", "Gray", "Color", NULL
SANE_VALUE_SCAN_MODE_LINEART,
SANE_VALUE_SCAN_MODE_GRAY,
SANE_VALUE_SCAN_MODE_COLOR,
NULL
};
static int scan_mode_to_code[] = {
@ -399,7 +402,7 @@ static SANE_Range threshold = {
static void reset_options(struct device *dev)
{
dev->val[OPT_RESOLUTION].w = 150;
dev->val[OPT_MODE].s = string_match(scan_modes, "Color");
dev->val[OPT_MODE].s = string_match(scan_modes, SANE_VALUE_SCAN_MODE_COLOR);
/* if docs loaded in adf use it as default source, flatbed oterwise */
dev->val[OPT_SOURCE].s = UNCONST(doc_sources[(dev->doc_loaded)? 1 : 0]);

Wyświetl plik

@ -452,7 +452,10 @@ SANE_I18N("Turn off lamp when program exits")
/* Typical values for stringlists (to keep the backends consistent) */
#define SANE_VALUE_SCAN_MODE_COLOR SANE_I18N("Color")
#define SANE_VALUE_SCAN_MODE_COLOR_LINEART SANE_I18N("Color Lineart")
#define SANE_VALUE_SCAN_MODE_COLOR_HALFTONE SANE_I18N("Color Halftone")
#define SANE_VALUE_SCAN_MODE_GRAY SANE_I18N("Gray")
#define SANE_VALUE_SCAN_MODE_HALFTONE SANE_I18N("Halftone")
#define SANE_VALUE_SCAN_MODE_LINEART SANE_I18N("Lineart")
#endif /* saneopts_h */