twain3/SaneUI/Global.h

144 lines
5.8 KiB
C++

#pragma once
#include "json.hpp"
#ifdef WIN32
#include <ShlObj_core.h>
#endif // WIN32
#include <string>
#include <iostream> //std::cout
#define MACR2STR(R) #R
#define STR2MACRO(R) MACR2STR(R)
using json = nlohmann::json;
using namespace std;
struct Func
{
Func(std::function<void(const std::string&)> scan, std::function<void(const std::string&)> confirm, std::function<void()> canle, std::function<void()> stop, std::function<std::string()> getfw, std::function <std::string()> getser) :
IscanFunction(scan), IconfirmFunction(confirm), IcancelFunction(canle), IstopFunction(stop),Igetfw(getfw),Igetser(getser) {}
std::function<void(const std::string&)> IscanFunction;
std::function<void(const std::string&)> IconfirmFunction;
std::function<void()> IcancelFunction;
std::function<void()> IstopFunction;
std::function<std::string()> Igetfw;
std::function<std::string()> Igetser;
};
namespace Global {
static inline std::string getSettingPath()
{
#ifdef WIN32
TCHAR dir[MAX_PATH] = { 0 };
SHGetSpecialFolderPath(NULL, dir, CSIDL_LOCAL_APPDATA, TRUE);
int iLen = WideCharToMultiByte(CP_ACP, 0, (LPCWCH)dir, -1, NULL, 0, NULL, NULL);
char* chRtn = new char[iLen * sizeof(char)];
WideCharToMultiByte(CP_ACP, 0, (LPCWCH)dir, -1, chRtn, iLen, NULL, NULL);
std::string path(chRtn);
delete[] chRtn;
return path + "/huagoscan/";
#else
std::cout<<STR2MACRO(JSONPATH)<<std::endl;
return STR2MACRO(JSONPATH);
#endif // WIN32
}
};
const std::string appJsonName = "userSettings.json";
const std::string userJsonName = STR2MACRO(USERJSONNAME);
#if defined (HGVERSION)
const std::string manufacturer = "宁波华高信息科技有限公司";
const std::string contact_address = "浙江省宁波市学士路655号 C-211";
const std::string website = "www.huagaochina.com";
#else
const std::string manufacturer = "北京立思辰计算机技术有限公司";
const std::string contact_address = "中国北京市海淀区学清路8号科技财富中心B座3A层";
const std::string website = "www.lanxum.com";
#endif
const std::string CONFIG = "config";
const std::string SYSTEM = "system";
const std::string USER = "user";
const std::string DEFAULT = "default";
const std::string VALUE = "value";
const std::string G100 = "G100";
const std::string G200 = "G200";
const std::string G300 = "G300";
const std::string G400 = "G400";
const std::string SPAPERSIZE = "sPaperSize";
//<!基本选项卡
const std::string DPI = "dpi";
const std::string PIXTYPE = "iPixType";
const std::string PAPERSIZE = "iPaperSize";
const std::string PAPERSIZENAME = "iPaperSizeName";
const std::string PAPERALIGN = "iPaperAlign";
const std::string RESOLUTION = "iResolution";
const std::string RESOLUTIONNATIVE = "iResolution_native";
const std::string DUPLEX = "bDuplex";
const std::string DISCARBLANK = "bDiscardBlank";
const std::string DISCARBLANKVINCE = "bDiscardBlankVince";
//#define DB_AREANUM "iAreaNum"
//#define DB_DEVNMAX "iDevnMax"
const std::string FOLD = "bFold";
const std::string AUTOCROP = "bAuotCrop";
const std::string EXCHANGEFB = "bExchangeFrontBack";
const std::string AUTOMATICCOLOR = "bAutoMaticColorDetece";
const std::string AUTOMATICCOLORTYPR = "iAutoMaticColorDeteceType";
//<!亮度对比度选项卡
//#define AUTOCONTRAST "bAutoContrast"
const std::string CUSTOMGAMMATABLEL = "customGammatableLength";
const std::string CUSTOMGAMMATABLE = "customGamma_table";
const std::string CUSTOMGAMMA = "customGamma";
const std::string BRIGHTNESS = "iBrightness";
const std::string CONTRAST = "iContrast";
const std::string GAMMA = "fGamma";
const std::string GAMMATABLE = "igammatable";
const std::string GAMMATABLELENGHT = "igammatablelenght";
//<!图像处理选项卡
const std::string CONVEX = "iconvex";
const std::string FILLCOLOR="ifillcolor";
const std::string AUTO_THRESHOLD = "iAutoCrop_threshold";
const std::string NOISE = "inoise";
const std::string INDENT = "indent";
const std::string FILLBLACK = "bFillBlcak";
const std::string AUTODESCREW = "bAutoDescrew";
const std::string OUTHOLE = "bOutHole";
const std::string OUTHOLERATIO = "iOutHoleRatio";
const std::string FILTERTYPE = "iFilter";
const std::string NOISEDETACH = "nosieDetach";
const std::string SHARPENTYPE = "iSharpen";
const std::string MULTIOUTPUTR = "bMultiOutPutR";
const std::string MULTIOUTPUT = "bMultiOutput";
const std::string ANSWERSHEETR = "bAnswerSheetR";
const std::string SPLITIMAGE = "splitImage";
const std::string ERROREXTENTION = "errorExtention";//错误扩散
const std::string TEXTUREREMOVE = "textureRemove"; //除网纹
const std::string REFUSEINFLOW = "irefuseinflow";//防止渗透
const std::string REMOVEMORR = "iremovemorr";//除摩尔纹
const std::string COLORCORRECTION = "icolorCorrection";
const std::string CROPRECT_ENABLE = "icroprect_enable";
const std::string CROPRECT_X = "icroprect_x";
const std::string CROPRECT_Y = "icroprect_y";
const std::string CROPRECT_H = "icroprect_h";
const std::string CROPRECT_W = "icroprect_w";
const std::string BACKGROUNDREMOVAL="ibackgroundremoval";
//<!送纸选项卡
const std::string CAPTRUEPIXTYPE = "capturepixtype";
const std::string SCANCOUNT = "ScanCount";
const std::string DOCORIENTATION = "iOrientation";
const std::string BACKROTATE180 = "bBackRotate180";
const std::string ULTRADETECT = "bUltrasonicDetect";
const std::string BINDINGDETECT = "bBindingDetect";
const std::string DOUBLEFOODD = "bdoublefooddetection";
const std::string SKEWDENABLE = "iSkewEnable";
const std::string SKEWLEVEL = "iSkewLevel";
const std::string SIZEDETECT = "iSizeDetect";
//<!保存信息
const std::string ITEMCAPTION = "Caption";
const std::string SAVEPATH = "SavePath";