From: Bastian Dehn Date: Mon, 4 Mar 2024 19:48:43 +0000 (+0100) Subject: remove special option combination X-Git-Tag: v1.0.0^2~138^2~4 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=f8209323f2ec01fbbb6921421c4a623cd031a53f;p=sane-kds-s2000w-net.git remove special option combination --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index ec6a346..ee1e06b 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -60,52 +60,6 @@ void _load_options(handler* h) resp = NULL; } -int _change_output_type_to_images() -{ - json_object* value_object = json_object_object_get(config, "ColorMode"); - const char* color_mode_value = json_object_get_string(value_object); - if (strcmp(color_mode_value, "Color_BW") != 0) { - value_object = NULL; - value_object = json_object_object_get(config, "OutputType"); - const char* reset_value_ptr = "Images"; - _write_string_value_to_json(value_object, (void*) reset_value_ptr); - value_object = NULL; - return 1; - } - - return 0; -} - -int _color_change_to_color_bw() -{ - json_object* value_object = json_object_object_get(config, "ColorMode"); - const char* color_mode_value = json_object_get_string(value_object); - if (strcmp(color_mode_value, "Color_BW") != 0) { - const char* reset_value_ptr = "Color_BW"; - _write_string_value_to_json(value_object, (void*) reset_value_ptr); - value_object = NULL; - return 1; - } - - return 0; -} - -int _change_skip_blank_pages_off() -{ - json_object* value_object = json_object_object_get(config, "OutputType"); - const char* output_type = json_object_get_string(value_object); - value_object = NULL; - - if (strcmp(output_type, "SinglePageColorPDFPlus2TIFs") == 0) { - value_object = json_object_object_get(config, "SkipBlankPages"); - json_object_set_int(value_object, 0); - value_object = NULL; - return 1; - } - - return 0; -} - void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* info) { config = json_object_object_get(resp_config, "Configuration"); @@ -227,9 +181,6 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf _write_string_value_to_json(value_object, value); value_object = NULL; - if (_change_output_type_to_images()) - *info = RELOAD_OPTIONS; - char* str_Value = (char*) value; if (strcmp(str_Value, "Color") == 0) { h->current_metadata->format = 1; @@ -262,10 +213,6 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf value_object = json_object_object_get(config, "SkipBlankPages"); _write_int_value_to_json(value_object, value); value_object = NULL; - - if (_change_skip_blank_pages_off()) - *info = RELOAD_OPTIONS; - break; case 9: int* autostart_value = (int*) value; @@ -286,13 +233,6 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf value_object = json_object_object_get(config, "OutputType"); _write_string_value_to_json(value_object, value); value_object = NULL; - - if (_color_change_to_color_bw()) - *info = RELOAD_OPTIONS; - - if (_change_skip_blank_pages_off()) - *info = RELOAD_OPTIONS; - break; case 13: value_object = json_object_object_get(config, "ColorAutoBrightnessMode"); diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index ba6d10e..874dfa7 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -132,12 +132,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_mode() descriptor->desc = SANE_DESC_SCAN_MODE; descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; - constraint_colormode = malloc(sizeof(char*) * 5); + constraint_colormode = malloc(sizeof(char*) * 4); constraint_colormode[0] = "Color"; constraint_colormode[1] = "Gray"; constraint_colormode[2] = "BW"; - constraint_colormode[3] = "Color_BW"; - constraint_colormode[4] = NULL; + constraint_colormode[3] = NULL; descriptor->constraint.string_list = constraint_colormode; descriptor->type = SANE_TYPE_STRING; descriptor->unit = SANE_UNIT_NONE; @@ -240,10 +239,9 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_output_type() descriptor->desc = "outputtype"; descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; - constraint_output_type = malloc(sizeof(char*) * 3); + constraint_output_type = malloc(sizeof(char*) * 2); constraint_output_type[0] = "Images"; - constraint_output_type[1] = "SinglePageColorPDFPlus2TIFs"; - constraint_output_type[2] = NULL; + constraint_output_type[1] = NULL; descriptor->constraint.string_list = constraint_output_type; descriptor->type = SANE_TYPE_STRING; descriptor->unit = SANE_UNIT_NONE;