2023-10-11 09:39:36 +00:00
|
|
|
|
#include "common_setting.h"
|
2022-05-13 08:39:21 +00:00
|
|
|
|
#include "sane/sane_option_definitions.h"
|
2023-01-18 10:08:47 +00:00
|
|
|
|
#include "hg_log.h"
|
2023-01-19 07:43:59 +00:00
|
|
|
|
|
|
|
|
|
#define MAKE_ID_AND_STR(id) id, hg_log::lang_load(id)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
static struct _fixed_option
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
int str_id;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
std::string str;
|
|
|
|
|
int enum_val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_color_mode[] =
|
|
|
|
|
{
|
2023-01-18 10:08:47 +00:00
|
|
|
|
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_YSMS_HB), COLOR_MODE_BLACK_WHITE },
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_YSMS_256JHD), COLOR_MODE_256_GRAY},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_YSMS_24WCS), COLOR_MODE_24_BITS},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_YSMS_YSZDSB), COLOR_MODE_AUTO_MATCH}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
g_multi_out[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_DLSCLX_CS_HD_HB), MULTI_OUT_ALL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_DLSCLX_CS_HD), MULTI_COLOR_AND_GRAY},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_DLSCLX_CS_HB), MULTI_COLOR_AND_BW},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_DLSCLX_HD_HB), MULTI_GRAY_AND_BW}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
g_rid_color[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_BCS), RID_COLOR_NONE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_CHS), RID_COLOR_RID_RED},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_CLS), RID_COLOR_RID_GREEN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_CHULANSE), RID_COLOR_RID_BLUE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_HSZQ), RID_COLOR_ENHANCE_RED},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_LSZQ), RID_COLOR_ENHANCE_GREEN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HDHHBTX_CSYZQ_LANSEZENGQIANG), RID_COLOR_ENHANCE_BLUE}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_paper[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A3), PAPER_A3},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A4), PAPER_A4},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A5), PAPER_A5},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A6), PAPER_A6},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_B4), PAPER_B4},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_B5), PAPER_B5},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_B6), PAPER_B6},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_8K), PAPER_8K},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_16K), PAPER_16K},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_Letter), PAPER_LETTER},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A4HX), PAPER_A4_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A5HX), PAPER_A5_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_A6HX), PAPER_A6_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_B5HX), PAPER_B5_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_B6HX), PAPER_B6_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_16KHX), PAPER_16K_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_LetterHX), PAPER_LETTER_LATERAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_DoubleLetter), PAPER_DOUBLE_LETTER},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_LEGAL), PAPER_LEGAL},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_PPYSCC), PAPER_AUTO_MATCH},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_ZDSMCC), PAPER_MAX_SIZE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_ZDSMCCZDCQ), PAPER_MAX_SIZE_CLIP},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZZCC_SLSJ), PAPER_TRIGEMINY}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_page[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_DM), PAGE_SINGLE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_SM), PAGE_DOUBLE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYTY), PAGE_OMIT_EMPTY},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYFPZ), PAGE_OMIT_EMPTY_RECEIPT},
|
2023-10-31 06:41:28 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYJYWJDX), PAGE_OMIT_EMPTY_FILE_SIZE},
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_DZ), PAGE_FOLIO}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_sharpen[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_RHYMH_W), SHARPEN_NONE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_RHYMH_RH), SHARPEN_SHARPEN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_RHYMH_JYBRH), SHARPEN_SHARPEN_MORE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_RHYMH_MH), SHARPEN_HAZY},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_RHYMH_JYBMH), SHARPEN_HAZY_MORE}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_fill_bkg[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_BJTCFS_TDBX), FILL_BKG_CONVEX_POLYGON},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_BJTCFS_ADBX), FILL_BKG_CONCAVE_POLYGON}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_scan_mode[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMZS_LXSM), SCAN_MODE_CONTINUOUS},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMZS_SMZDZS), SCAN_MODE_GIVEN_COUNT}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_text_direction[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_WGFX_0), TEXT_DIRECTION_0},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_WGFX_90), TEXT_DIRECTION_90},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_WGFX_180), TEXT_DIRECTION_180},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_WGFX__90), TEXT_DIRECTION_270},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_WGFX_ZDWBFXSB), TEXT_DIRECTION_AUTO}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
g_permeate_lv[] =
|
|
|
|
|
{
|
2023-11-21 09:37:16 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZSTDJ_JR), PERMAEATE_WEAK},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZSTDJ_R), PERMAEATE_WEAKER},
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZSTDJ_YB), PERMAEATE_ORDINARY},
|
2023-11-21 09:37:16 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZSTDJ_Q), PERMAEATE_STRONGER},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZSTDJ_JQ), PERMAEATE_STRONG}
|
2022-05-09 07:02:00 +00:00
|
|
|
|
},
|
|
|
|
|
g_img_quality[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HZ_W), IMG_NONE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HZ_SDYX), IMG_SPEED},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_HZ_HZYX), IMG_QUALITY}
|
2022-08-08 10:15:51 +00:00
|
|
|
|
},
|
|
|
|
|
g_paper_strenght[]=
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZQD_R),PAPER_WEAK},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZQD_YB),PAPER_AVERAGE},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_FZQD_Q),PAPER_STRONG}
|
2022-08-08 10:15:51 +00:00
|
|
|
|
},
|
|
|
|
|
g_sleep_time[]=
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_BXM),SLEEP_TIME_0MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_WFZ),SLEEP_TIME_5MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_SFZ),SLEEP_TIME_10MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_BXS),SLEEP_TIME_30MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_YXS),SLEEP_TIME_60MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_LXS),SLEEP_TIME_120MIN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_XMSJ_SXS),SLEEP_TIME_240MIN},
|
2022-10-22 08:18:13 +00:00
|
|
|
|
},
|
|
|
|
|
g_fold_type[] =
|
|
|
|
|
{
|
2023-01-19 07:43:59 +00:00
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZYDZ),FOLD_TYPE_LEFT_RIGHT},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SXDZ),FOLD_TYPE_UP_DOWN},
|
|
|
|
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_ZDDZ),FOLD_TYPE_AUTO}
|
2022-10-22 08:18:13 +00:00
|
|
|
|
};
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-20 06:46:25 +00:00
|
|
|
|
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}}
|
|
|
|
|
};
|
2022-06-15 03:05:36 +00:00
|
|
|
|
// 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 毫米).
|
2022-05-09 07:02:00 +00:00
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2023-01-19 07:43:59 +00:00
|
|
|
|
static void reload_string(struct _fixed_option* arr, int num)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < num; ++i)
|
|
|
|
|
arr[i].str = hg_log::lang_load(arr[i].str_id);
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2023-01-19 07:43:59 +00:00
|
|
|
|
#define RELOAD_STRING(arr) reload_string(arr, ARRAY_SIZE(arr))
|
2022-05-03 03:56:07 +00:00
|
|
|
|
#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)
|
2022-05-13 08:39:21 +00:00
|
|
|
|
#define SET_DEFAULT_ON_FAIL(map_array, ind, val, def) \
|
|
|
|
|
if(ind == -1) \
|
|
|
|
|
{ \
|
|
|
|
|
ind = def; \
|
|
|
|
|
val = INVOKE_STR(map_array, def, def); \
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int match_best_color_mode(std::string& val, bool* exact)
|
|
|
|
|
{
|
|
|
|
|
bool yes = true;
|
|
|
|
|
int ind = INVOKE_MATCH(g_color_mode, val, yes);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_color_mode, ind, val, COLOR_MODE_24_BITS);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-06-02 03:47:44 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_multi_out, ind, val, MULTI_OUT_ALL);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_rid_color, ind, val, RID_COLOR_NONE);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
if (exact)
|
|
|
|
|
*exact = yes;
|
|
|
|
|
|
|
|
|
|
return ind;
|
|
|
|
|
}
|
2022-05-20 06:46:25 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-03 08:11:10 +00:00
|
|
|
|
//return SIZE{ 2338, 3307 };
|
|
|
|
|
|
|
|
|
|
return SIZE{ 297, 420 }; // A3
|
2022-05-20 06:46:25 +00:00
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
int match_best_paper(std::string& val, bool* exact)
|
|
|
|
|
{
|
|
|
|
|
bool yes = true;
|
|
|
|
|
int ind = INVOKE_MATCH(g_paper, val, yes);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_paper, ind, val, PAPER_A4);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_page, ind, val, PAGE_DOUBLE);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_sharpen, ind, val, SHARPEN_NONE);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_fill_bkg, ind, val, FILL_BKG_CONVEX_POLYGON);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_scan_mode, ind, val, SCAN_MODE_CONTINUOUS);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_text_direction, ind, val, TEXT_DIRECTION_0);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_permeate_lv, ind, val, TEXT_DIRECTION_0);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
if (exact)
|
|
|
|
|
*exact = yes;
|
|
|
|
|
|
|
|
|
|
return ind;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 07:02:00 +00:00
|
|
|
|
int match_best_img_quality(std::string& val, bool* exact)
|
|
|
|
|
{
|
|
|
|
|
bool yes = true;
|
|
|
|
|
int ind = INVOKE_MATCH(g_img_quality, val, yes);
|
|
|
|
|
|
2022-05-13 08:39:21 +00:00
|
|
|
|
SET_DEFAULT_ON_FAIL(g_img_quality, ind, val, IMG_SPEED);
|
2022-05-09 07:02:00 +00:00
|
|
|
|
if (exact)
|
|
|
|
|
*exact = yes;
|
|
|
|
|
|
|
|
|
|
return ind;
|
|
|
|
|
}
|
2022-08-08 10:15:51 +00:00
|
|
|
|
int match_best_paper_strength(std::string& val, bool* exact)
|
|
|
|
|
{
|
|
|
|
|
bool yes = true;
|
|
|
|
|
int ind = INVOKE_MATCH(g_paper_strenght, val, yes);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-08-08 10:15:51 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2022-10-22 08:18:13 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
2022-05-09 07:02:00 +00:00
|
|
|
|
std::string is_img_quality(int is_quakuty)
|
|
|
|
|
{
|
2022-08-02 03:14:58 +00:00
|
|
|
|
return INVOKE_STR(g_img_quality, is_quakuty + 1/*start from -1*/, 0);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
}
|
2022-08-08 10:15:51 +00:00
|
|
|
|
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);
|
2022-10-22 08:18:13 +00:00
|
|
|
|
}
|
|
|
|
|
std::string is_fold_type(int fold_type)
|
|
|
|
|
{
|
|
|
|
|
return INVOKE_STR(g_fold_type, fold_type, 0);
|
2022-08-08 10:15:51 +00:00
|
|
|
|
}
|
2022-07-23 05:42:34 +00:00
|
|
|
|
int double_paper_flag_from_option_value(std::string& opt_val, bool* exact)
|
|
|
|
|
{
|
|
|
|
|
if (exact)
|
|
|
|
|
*exact = true;
|
|
|
|
|
|
2023-10-11 09:39:36 +00:00
|
|
|
|
if (opt_val == hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_SCTXBTZSM))//上传图像并停止
|
|
|
|
|
return DOUBLE_PAPER_SAVE_IMG;
|
|
|
|
|
else if (opt_val == hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBTZSM))//丢弃图像并停止
|
|
|
|
|
return DOUBLE_PAPEAR_STOP;
|
|
|
|
|
else if (opt_val == from_default_language(OPTION_VALUE_SZTPCL_SCTXBJY))//上传图像并校验
|
2022-07-23 05:42:34 +00:00
|
|
|
|
return DOUBLE_PAPER_SAVE_IMG;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (exact)
|
2023-01-18 10:08:47 +00:00
|
|
|
|
*exact = opt_val == hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBTZSM);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
}
|
2023-02-17 07:16:22 +00:00
|
|
|
|
return 0;
|
2022-07-23 05:42:34 +00:00
|
|
|
|
}
|
2022-08-08 10:15:51 +00:00
|
|
|
|
|
2022-07-23 05:42:34 +00:00
|
|
|
|
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))
|
2023-01-18 10:08:47 +00:00
|
|
|
|
return hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_SCTXBJXSM);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
else
|
2023-01-18 10:08:47 +00:00
|
|
|
|
return hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBJXSM);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
}
|
|
|
|
|
else if (is_save_img_when_double_paper(flag))
|
2023-01-18 10:08:47 +00:00
|
|
|
|
return hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_SCTXBTZSM);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
else
|
2023-01-18 10:08:47 +00:00
|
|
|
|
return hg_log::lang_load(ID_OPTION_VALUE_SZTPCL_DQTXBTZSM);
|
2022-07-23 05:42:34 +00:00
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
2023-01-19 07:43:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void reload_setting_string_from_pak(int cp, void* param)
|
|
|
|
|
{
|
|
|
|
|
RELOAD_STRING(g_color_mode);
|
|
|
|
|
RELOAD_STRING(g_multi_out);
|
|
|
|
|
RELOAD_STRING(g_rid_color);
|
|
|
|
|
RELOAD_STRING(g_paper);
|
|
|
|
|
RELOAD_STRING(g_page);
|
|
|
|
|
RELOAD_STRING(g_sharpen);
|
|
|
|
|
RELOAD_STRING(g_fill_bkg);
|
|
|
|
|
RELOAD_STRING(g_scan_mode);
|
|
|
|
|
RELOAD_STRING(g_text_direction);
|
|
|
|
|
RELOAD_STRING(g_permeate_lv);
|
|
|
|
|
RELOAD_STRING(g_img_quality);
|
|
|
|
|
RELOAD_STRING(g_paper_strenght);
|
|
|
|
|
RELOAD_STRING(g_sleep_time);
|
|
|
|
|
RELOAD_STRING(g_fold_type);
|
|
|
|
|
}
|