532 lines
15 KiB
C++
532 lines
15 KiB
C++
#include "common_setting.h"
|
||
#include "sane/sane_option_definitions.h"
|
||
|
||
static struct _fixed_option
|
||
{
|
||
std::string str;
|
||
int enum_val;
|
||
}
|
||
|
||
g_color_mode[] =
|
||
{
|
||
{OPTION_VALUE_YSMS_HB, COLOR_MODE_BLACK_WHITE},
|
||
{OPTION_VALUE_YSMS_256JHD, COLOR_MODE_256_GRAY},
|
||
{OPTION_VALUE_YSMS_24WCS, COLOR_MODE_24_BITS},
|
||
{OPTION_VALUE_YSMS_YSZDSB, COLOR_MODE_AUTO_MATCH}
|
||
},
|
||
g_multi_out[] =
|
||
{
|
||
{OPTION_VALUE_DLSCLX_CS_HD_HB, MULTI_OUT_ALL},
|
||
{OPTION_VALUE_DLSCLX_CS_HD, MULTI_COLOR_AND_GRAY},
|
||
{OPTION_VALUE_DLSCLX_CS_HB, MULTI_COLOR_AND_BW},
|
||
{OPTION_VALUE_DLSCLX_HD_HB, MULTI_GRAY_AND_BW}
|
||
},
|
||
g_rid_color[] =
|
||
{
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_BCS, RID_COLOR_NONE},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_CHS, RID_COLOR_RID_RED},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_CLS, RID_COLOR_RID_GREEN},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_CHULANSE, RID_COLOR_RID_BLUE},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_HSZQ, RID_COLOR_ENHANCE_RED},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_LSZQ, RID_COLOR_ENHANCE_GREEN},
|
||
{OPTION_VALUE_HDHHBTX_CSYZQ_LANSEZENGQIANG, RID_COLOR_ENHANCE_BLUE}
|
||
},
|
||
|
||
g_paper[] =
|
||
{
|
||
{OPTION_VALUE_ZZCC_A3, PAPER_A3},
|
||
{OPTION_VALUE_ZZCC_A4, PAPER_A4},
|
||
{OPTION_VALUE_ZZCC_A5, PAPER_A5},
|
||
{OPTION_VALUE_ZZCC_A6, PAPER_A6},
|
||
{OPTION_VALUE_ZZCC_B4, PAPER_B4},
|
||
{OPTION_VALUE_ZZCC_B5, PAPER_B5},
|
||
{OPTION_VALUE_ZZCC_B6, PAPER_B6},
|
||
{OPTION_VALUE_ZZCC_8K, PAPER_8K},
|
||
{OPTION_VALUE_ZZCC_16K, PAPER_16K},
|
||
{OPTION_VALUE_ZZCC_Letter, PAPER_LETTER},
|
||
{OPTION_VALUE_ZZCC_A4HX, PAPER_A4_LATERAL},
|
||
{OPTION_VALUE_ZZCC_A5HX, PAPER_A5_LATERAL},
|
||
{OPTION_VALUE_ZZCC_A6HX, PAPER_A6_LATERAL},
|
||
{OPTION_VALUE_ZZCC_B5HX, PAPER_B5_LATERAL},
|
||
{OPTION_VALUE_ZZCC_B6HX, PAPER_B6_LATERAL},
|
||
{OPTION_VALUE_ZZCC_16KHX, PAPER_16K_LATERAL},
|
||
{OPTION_VALUE_ZZCC_LetterHX, PAPER_LETTER_LATERAL},
|
||
{OPTION_VALUE_ZZCC_DoubleLetter, PAPER_DOUBLE_LETTER},
|
||
{OPTION_VALUE_ZZCC_LEGAL, PAPER_LEGAL},
|
||
{OPTION_VALUE_ZZCC_PPYSCC, PAPER_AUTO_MATCH},
|
||
{OPTION_VALUE_ZZCC_ZDSMCC, PAPER_MAX_SIZE},
|
||
{OPTION_VALUE_ZZCC_ZDSMCCZDCQ, PAPER_MAX_SIZE_CLIP},
|
||
{OPTION_VALUE_ZZCC_SLSJ, PAPER_TRIGEMINY}
|
||
},
|
||
|
||
g_page[] =
|
||
{
|
||
{OPTION_VALUE_SMYM_DM, PAGE_SINGLE},
|
||
{OPTION_VALUE_SMYM_SM, PAGE_DOUBLE},
|
||
{OPTION_VALUE_SMYM_TGKBYTY, PAGE_OMIT_EMPTY},
|
||
{OPTION_VALUE_SMYM_TGKBYFPZ, PAGE_OMIT_EMPTY_RECEIPT},
|
||
{OPTION_VALUE_SMYM_DZ, PAGE_FOLIO}
|
||
},
|
||
|
||
g_sharpen[] =
|
||
{
|
||
{OPTION_VALUE_RHYMH_W, SHARPEN_NONE},
|
||
{OPTION_VALUE_RHYMH_RH, SHARPEN_SHARPEN},
|
||
{OPTION_VALUE_RHYMH_JYBRH, SHARPEN_SHARPEN_MORE},
|
||
{OPTION_VALUE_RHYMH_MH, SHARPEN_HAZY},
|
||
{OPTION_VALUE_RHYMH_JYBMH, SHARPEN_HAZY_MORE}
|
||
},
|
||
|
||
g_fill_bkg[] =
|
||
{
|
||
{OPTION_VALUE_BJTCFS_TDBX, FILL_BKG_CONVEX_POLYGON},
|
||
{OPTION_VALUE_BJTCFS_ADBX, FILL_BKG_CONCAVE_POLYGON}
|
||
},
|
||
|
||
g_scan_mode[] =
|
||
{
|
||
{OPTION_VALUE_SMZS_LXSM, SCAN_MODE_CONTINUOUS},
|
||
{OPTION_VALUE_SMZS_SMZDZS, SCAN_MODE_GIVEN_COUNT}
|
||
},
|
||
|
||
g_text_direction[] =
|
||
{
|
||
{OPTION_VALUE_WGFX_0, TEXT_DIRECTION_0},
|
||
{OPTION_VALUE_WGFX_90, TEXT_DIRECTION_90},
|
||
{OPTION_VALUE_WGFX_180, TEXT_DIRECTION_180},
|
||
{OPTION_VALUE_WGFX__90, TEXT_DIRECTION_270},
|
||
{OPTION_VALUE_WGFX_ZDWBFXSB, TEXT_DIRECTION_AUTO}
|
||
},
|
||
|
||
g_permeate_lv[] =
|
||
{
|
||
{OPTION_VALUE_FZSTDJ_JR, PERMAEATE_WEAKER},
|
||
{OPTION_VALUE_FZSTDJ_R, PERMAEATE_WEAK},
|
||
{OPTION_VALUE_FZSTDJ_YB, PERMAEATE_ORDINARY},
|
||
{OPTION_VALUE_FZSTDJ_Q, PERMAEATE_STRONG},
|
||
{OPTION_VALUE_FZSTDJ_JQ, PERMAEATE_STRONGER}
|
||
},
|
||
g_img_quality[] =
|
||
{
|
||
{OPTION_VALUE_HZ_W, IMG_NONE},
|
||
{OPTION_VALUE_HZ_SDYX, IMG_SPEED},
|
||
{OPTION_VALUE_HZ_HZYX, IMG_QUALITY}
|
||
},
|
||
g_paper_strenght[]=
|
||
{
|
||
{OPTION_VALUE_FZQD_R,PAPER_WEAK},
|
||
{OPTION_VALUE_FZQD_YB,PAPER_AVERAGE},
|
||
{OPTION_VALUE_FZQD_Q,PAPER_STRONG}
|
||
},
|
||
g_sleep_time[]=
|
||
{
|
||
{OPTION_VALUE_XMSJ_BXM,SLEEP_TIME_0MIN},
|
||
{OPTION_VALUE_XMSJ_WFZ,SLEEP_TIME_5MIN},
|
||
{OPTION_VALUE_XMSJ_SFZ,SLEEP_TIME_10MIN},
|
||
{OPTION_VALUE_XMSJ_BXS,SLEEP_TIME_30MIN},
|
||
{OPTION_VALUE_XMSJ_YXS,SLEEP_TIME_60MIN},
|
||
{OPTION_VALUE_XMSJ_LXS,SLEEP_TIME_120MIN},
|
||
{OPTION_VALUE_XMSJ_SXS,SLEEP_TIME_240MIN},
|
||
},
|
||
g_fold_type[] =
|
||
{
|
||
{OPTION_VALUE_ZYDZ,FOLD_TYPE_LEFT_RIGHT},
|
||
{OPTION_VALUE_SXDZ,FOLD_TYPE_UP_DOWN},
|
||
{OPTION_VALUE_ZDDZ,FOLD_TYPE_AUTO}
|
||
};
|
||
|
||
static struct paper_size
|
||
{
|
||
int paper;
|
||
SIZE size;
|
||
}g_paper_size[] =
|
||
{
|
||
{PAPER_A3, {297, 420}},
|
||
{PAPER_A4, {210, 297}},
|
||
{PAPER_A5, {148, 210}},
|
||
{PAPER_A6, {105, 148}},
|
||
{PAPER_B4, {257, 364}},
|
||
{PAPER_B5, {176, 250}}, // {PAPER_B5, {182, 257}},
|
||
{PAPER_B6, {125, 176}},
|
||
{PAPER_8K, {297, 420}},
|
||
{PAPER_16K, {210, 285}}, // {PAPER_16K, {185, 260}}
|
||
{PAPER_A4_LATERAL, {297, 210}},
|
||
{PAPER_A5_LATERAL, {210, 148}},
|
||
{PAPER_A6_LATERAL, {148, 105}},
|
||
{PAPER_B5_LATERAL, {250, 176}}, // {PAPER_B5, {182, 257}},
|
||
{PAPER_B6_LATERAL, {176, 125}}
|
||
};
|
||
// Custom 纸张的大小由用户定义.
|
||
// Letter Letter 纸(216 毫米 × 279 毫米).
|
||
// Legal Legal 纸(216 毫米 × 356 毫米).
|
||
// A4 A4 纸(210 毫米 × 297 毫米).
|
||
// CSheet C 纸(432 毫米 × 559 毫米).
|
||
// DSheet D 纸(559 毫米 × 864 毫米).
|
||
// ESheet E 纸(864 毫米 × 1118 毫米).
|
||
// LetterSmall Letter small 纸(216 毫米 × 279 毫米).
|
||
// Tabloid Tabloid 纸(279 毫米 × 432 毫米).
|
||
// Ledger Ledger 纸(432 毫米 × 279 毫米).
|
||
// Statement Statement 纸(140 毫米 × 216 毫米).
|
||
// Executive Executive 纸(184 毫米 × 267 毫米).
|
||
// A3 A3 纸(297 毫米 × 420 毫米).
|
||
// A4Small A4 small 纸(210 毫米 × 297 毫米).
|
||
// A5 A5 纸(148 毫米 × 210 毫米).
|
||
// B4 B4 纸(250 × 353 毫米).
|
||
// B5 B5 纸(176 毫米 × 250 毫米).
|
||
// Folio Folio 纸(216 毫米 × 330 毫米).
|
||
// Quarto Quarto 纸(215 毫米 × 275 毫米).
|
||
// Standard10x14 Standard 纸(254 毫米 × 356 毫米).
|
||
// Standard11x17 Standard 纸(279 毫米 × 432 毫米).
|
||
// Note Note 纸(216 毫米 × 279 毫米).
|
||
// Number9Envelope #9 envelope(98 毫米 × 225 毫米).
|
||
// Number10Envelope #10 envelope(105 毫米 × 241 毫米).
|
||
// Number11Envelope #11 envelope(114 毫米 × 263 毫米).
|
||
// Number12Envelope #12 envelope(120 毫米 × 279 毫米).
|
||
// Number14Envelope #14 envelope(127 毫米 × 292 毫米).
|
||
// DLEnvelope DL 信封(110 毫米 × 220 毫米).
|
||
// C5Envelope C5 信封(162 毫米 × 229 毫米).
|
||
// C3Envelope C3 信封(324 毫米 × 458 毫米).
|
||
// C4Envelope C4 信封(229 毫米 × 324 毫米).
|
||
// C6Envelope C6 信封(114 毫米 × 162 毫米).
|
||
// C65Envelope C65 信封(114 毫米 × 229 毫米).
|
||
// B4Envelope B4 信封(250 × 353 毫米).
|
||
// B5Envelope B5 信封(176 毫米 × 250 毫米).
|
||
// B6Envelope B6 信封(176 毫米 × 125 毫米).
|
||
// ItalyEnvelope Italy envelope(110 毫米 × 230 毫米).
|
||
// MonarchEnvelope Monarch envelope(98 毫米 × 191 毫米).
|
||
// PersonalEnvelope 6 3 / 4 envelope(92 毫米 × 165 毫米).
|
||
// USStandardFanfold US standard fanfold(378 毫米 × 279 毫米).
|
||
// GermanStandardFanfold German standard fanfold(216 毫米 × 305 毫米).
|
||
// GermanLegalFanfold German legal fanfold(216 毫米 × 330 毫米).
|
||
// IsoB4 ISO B4(250 毫米 × 353 毫米).
|
||
// JapanesePostcard Japanese postcard(100 毫米 × 148 毫米).
|
||
// Standard9x11 Standard 纸(229 毫米 × 279 毫米).
|
||
// Standard10x11 Standard 纸(254 毫米 × 279 毫米).
|
||
// Standard15x11 Standard 纸(381 毫米 × 279 毫米).
|
||
// InviteEnvelope 邀请函信封(220 毫米 × 220 毫米).
|
||
// LetterExtra Letter extra 纸(236 毫米 × 305 毫米).该值特定于 PostScript 驱动程序, 仅供 Linotronic 打印机使用以节省纸张.
|
||
// LegalExtra Legal extra 纸(236 毫米 × 381 毫米).该值特定于 PostScript 驱动程序, 仅供 Linotronic 打印机使用以节省纸张.
|
||
// TabloidExtra Tabloid extra 纸(297 毫米 × 457 毫米).该值特定于 PostScript 驱动程序, 仅供 Linotronic 打印机使用以节省纸张.
|
||
// A4Extra A4 extra 纸(236 毫米 × 322 毫米).该值是针对 PostScript 驱动程序的, 仅供 Linotronic 打印机使用以节省纸张.
|
||
// LetterTransverse Letter transverse 纸(210 毫米 × 279 毫米).
|
||
// A4Transverse A4 transverse 纸(210 毫米 × 297 毫米).
|
||
// LetterExtraTransverse Letter extra transverse 纸(236 毫米 × 305 毫米).
|
||
// APlus SuperA / SuperA / A4 纸(227 毫米 × 356 毫米).
|
||
// BPlus SuperB / SuperB / A3 纸(305 毫米 × 487 毫米).
|
||
// LetterPlus Letter plus 纸(216 毫米 × 322 毫米).
|
||
// A4Plus A4 plus 纸(210 毫米 × 330 毫米).
|
||
// A5Transverse A5 transverse 纸(148 毫米 × 210 毫米).
|
||
// B5Transverse JIS B5 transverse 纸(182 毫米 × 257 毫米).
|
||
// A3Extra A3 extra 纸(322 毫米 × 445 毫米).
|
||
// A5Extra A5 extra 纸(174 毫米 × 235 毫米).
|
||
// B5Extra ISO B5 extra 纸(201 毫米 × 276 毫米).
|
||
// A2 A2 纸(420 毫米 × 594 毫米).
|
||
// A3Transverse A3 transverse 纸(297 毫米 × 420 毫米).
|
||
// A3ExtraTransverse A3 extra transverse 纸(322 毫米 × 445 毫米).
|
||
|
||
static int match_best(struct _fixed_option* arr, size_t num, std::string& val, bool& exact)
|
||
{
|
||
exact = true;
|
||
for (size_t i = 0; i < num; ++i)
|
||
{
|
||
if (arr[i].str == val)
|
||
return arr[i].enum_val;
|
||
}
|
||
|
||
exact = false;
|
||
|
||
return -1;
|
||
}
|
||
static std::string get_str(struct _fixed_option* arr, int num, int enm, int default_v = 0)
|
||
{
|
||
if (enm >= 0 && enm < num)
|
||
return arr[enm].str;
|
||
else
|
||
return arr[default_v].str;
|
||
}
|
||
|
||
#define INVOKE_MATCH(arr, val, yes) match_best(arr, ARRAY_SIZE(arr), val, yes)
|
||
#define INVOKE_STR(arr, val, def) get_str(arr, ARRAY_SIZE(arr), val, def)
|
||
#define SET_DEFAULT_ON_FAIL(map_array, ind, val, def) \
|
||
if(ind == -1) \
|
||
{ \
|
||
ind = def; \
|
||
val = INVOKE_STR(map_array, def, def); \
|
||
}
|
||
|
||
int match_best_color_mode(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_color_mode, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_color_mode, ind, val, COLOR_MODE_24_BITS);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_multi_out(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_multi_out, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_multi_out, ind, val, MULTI_OUT_ALL);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
|
||
}
|
||
int match_best_rid_color(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_rid_color, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_rid_color, ind, val, RID_COLOR_NONE);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
SIZE paper_size(int paper)
|
||
{
|
||
for (size_t i = 0; i < ARRAY_SIZE(g_paper_size); ++i)
|
||
{
|
||
if (g_paper_size[i].paper == paper)
|
||
return g_paper_size[i].size;
|
||
}
|
||
|
||
return SIZE{ 2338, 3307 };
|
||
}
|
||
int match_best_paper(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_paper, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_paper, ind, val, PAPER_A4);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_page(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_page, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_page, ind, val, PAGE_DOUBLE);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_sharpen(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_sharpen, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_sharpen, ind, val, SHARPEN_NONE);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_fill_background(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_fill_bkg, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_fill_bkg, ind, val, FILL_BKG_CONVEX_POLYGON);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_scan_mode(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_scan_mode, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_scan_mode, ind, val, SCAN_MODE_CONTINUOUS);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_text_direction(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_text_direction, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_text_direction, ind, val, TEXT_DIRECTION_0);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
|
||
int match_best_permaeate_lv(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_permeate_lv, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_permeate_lv, ind, val, TEXT_DIRECTION_0);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
|
||
int match_best_img_quality(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_img_quality, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_img_quality, ind, val, IMG_SPEED);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_paper_strength(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_paper_strenght, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_paper_strenght, ind, val, PAPER_WEAK);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_sleep_time(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_sleep_time, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_sleep_time, ind, val, SLEEP_TIME_0MIN);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
int match_best_fold_type(std::string& val, bool* exact)
|
||
{
|
||
bool yes = true;
|
||
int ind = INVOKE_MATCH(g_fold_type, val, yes);
|
||
|
||
SET_DEFAULT_ON_FAIL(g_fold_type, ind, val, FOLD_TYPE_AUTO);
|
||
if (exact)
|
||
*exact = yes;
|
||
|
||
return ind;
|
||
}
|
||
std::string color_mode_string(int clr_mode)
|
||
{
|
||
return INVOKE_STR(g_color_mode, clr_mode, 0);
|
||
}
|
||
std::string multi_out_string(int multi_out)
|
||
{
|
||
return INVOKE_STR(g_multi_out, multi_out, 0);
|
||
}
|
||
std::string rid_color_string(int rid_color)
|
||
{
|
||
return INVOKE_STR(g_rid_color, rid_color, 0);
|
||
}
|
||
std::string paper_string(int paper)
|
||
{
|
||
return INVOKE_STR(g_paper, paper, 1);
|
||
}
|
||
bool is_lateral(int paper)
|
||
{
|
||
return paper == PAPER_A4_LATERAL
|
||
|| paper == PAPER_A5_LATERAL
|
||
|| paper == PAPER_A6_LATERAL
|
||
|| paper == PAPER_B5_LATERAL
|
||
|| paper == PAPER_B6_LATERAL
|
||
|| paper == PAPER_16K_LATERAL
|
||
|| paper == PAPER_LETTER_LATERAL;
|
||
}
|
||
std::string page_string(int page)
|
||
{
|
||
return INVOKE_STR(g_page, page, 1);
|
||
}
|
||
std::string sharpen_string(int sharpen)
|
||
{
|
||
return INVOKE_STR(g_sharpen, sharpen, 0);
|
||
}
|
||
std::string fill_background_string(int fill)
|
||
{
|
||
return INVOKE_STR(g_fill_bkg, fill, 0);
|
||
}
|
||
std::string scan_mode_string(int mode)
|
||
{
|
||
return INVOKE_STR(g_scan_mode, mode, 0);
|
||
}
|
||
std::string text_direction_string(int text_dir)
|
||
{
|
||
return INVOKE_STR(g_text_direction, text_dir, 0);
|
||
}
|
||
std::string is_permaeate_string(int permaeate_lv)
|
||
{
|
||
return INVOKE_STR(g_permeate_lv, permaeate_lv, 0);
|
||
}
|
||
std::string is_img_quality(int is_quakuty)
|
||
{
|
||
return INVOKE_STR(g_img_quality, is_quakuty + 1/*start from -1*/, 0);
|
||
}
|
||
std::string is_paper_strength(int strength)
|
||
{
|
||
return INVOKE_STR(g_paper_strenght, strength, 0);
|
||
}
|
||
std::string is_sleep_time(int sleep_time)
|
||
{
|
||
return INVOKE_STR(g_sleep_time, sleep_time, 0);
|
||
}
|
||
std::string is_fold_type(int fold_type)
|
||
{
|
||
return INVOKE_STR(g_fold_type, fold_type, 0);
|
||
}
|
||
int double_paper_flag_from_option_value(std::string& opt_val, bool* exact)
|
||
{
|
||
if (exact)
|
||
*exact = true;
|
||
|
||
if (opt_val == OPTION_VALUE_SZTPCL_SCTXBJXSM)
|
||
return DOUBLE_PAPER_CONTINUE | DOUBLE_PAPER_SAVE_IMG;
|
||
else if (opt_val == OPTION_VALUE_SZTPCL_SCTXBTZSM)
|
||
return DOUBLE_PAPER_SAVE_IMG;
|
||
else if (opt_val == OPTION_VALUE_SZTPCL_DQTXBJXSM)
|
||
return DOUBLE_PAPER_CONTINUE;
|
||
else
|
||
{
|
||
if (exact)
|
||
*exact = opt_val == OPTION_VALUE_SZTPCL_DQTXBTZSM;
|
||
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
std::string double_paper_flag_to_option_value(int flag)
|
||
{
|
||
if (is_continue_when_double_paper(flag))
|
||
{
|
||
if (is_save_img_when_double_paper(flag))
|
||
return OPTION_VALUE_SZTPCL_SCTXBJXSM;
|
||
else
|
||
return OPTION_VALUE_SZTPCL_DQTXBJXSM;
|
||
}
|
||
else if (is_save_img_when_double_paper(flag))
|
||
return OPTION_VALUE_SZTPCL_SCTXBTZSM;
|
||
else
|
||
return OPTION_VALUE_SZTPCL_DQTXBTZSM;
|
||
}
|
||
bool is_continue_when_double_paper(int flag)
|
||
{
|
||
return flag & DOUBLE_PAPER_CONTINUE;
|
||
}
|
||
bool is_save_img_when_double_paper(int flag)
|
||
{
|
||
return flag& DOUBLE_PAPER_SAVE_IMG;
|
||
}
|