2020-03-11 01:58:06 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include "twglue.hpp"
|
|
|
|
|
#include "CSaveConfigDlg.h"
|
|
|
|
|
#include "Device/PublicFunc.h"
|
|
|
|
|
#include "Device/PaperSize.h"
|
|
|
|
|
#include <map>
|
2020-06-20 03:04:32 +00:00
|
|
|
|
#include "MapFinder.h"
|
|
|
|
|
#include <vector>
|
2020-03-11 01:58:06 +00:00
|
|
|
|
class CTabCtrlSSL;
|
|
|
|
|
class CTabPageSSL;
|
|
|
|
|
class CImageProcPage;
|
|
|
|
|
class CBasicPage;
|
|
|
|
|
class CFeedPaperPage;
|
|
|
|
|
class CBrightnessPage;
|
|
|
|
|
|
|
|
|
|
/*配置文件默认索引号*/
|
2020-11-16 10:05:04 +00:00
|
|
|
|
#define SUPPORTRESNUMS 6
|
|
|
|
|
static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300,600};
|
2020-03-11 01:58:06 +00:00
|
|
|
|
|
|
|
|
|
#define TWPT_BW 0
|
|
|
|
|
#define TWPT_GRAY 1
|
|
|
|
|
#define TWPT_RGB 2
|
|
|
|
|
|
2020-06-20 03:04:32 +00:00
|
|
|
|
#ifdef G200
|
2020-03-11 01:58:06 +00:00
|
|
|
|
static std::map<int, PaperStatus> paperStatusMap = {
|
|
|
|
|
{0,{TwSS::A3,PaperAlign::Rot0}},
|
|
|
|
|
{1,{TwSS::A4,PaperAlign::Rot0}},
|
|
|
|
|
{2,{TwSS::A4,PaperAlign::Rot270}},
|
|
|
|
|
{3,{TwSS::A5,PaperAlign::Rot0}},
|
|
|
|
|
{4,{TwSS::A5,PaperAlign::Rot270}},
|
|
|
|
|
{5,{TwSS::A6,PaperAlign::Rot0}},
|
|
|
|
|
{6,{TwSS::A6,PaperAlign::Rot270}},
|
|
|
|
|
{7,{TwSS::B4,PaperAlign::Rot0}},
|
|
|
|
|
{8,{TwSS::B5,PaperAlign::Rot0}},
|
|
|
|
|
{9,{TwSS::B5,PaperAlign::Rot270}},
|
|
|
|
|
{10,{TwSS::B6,PaperAlign::Rot0}},
|
|
|
|
|
{11,{TwSS::B6,PaperAlign::Rot270}},
|
|
|
|
|
{12,{TwSS::USLetter,PaperAlign::Rot0}},
|
|
|
|
|
{13,{TwSS::USLetter,PaperAlign::Rot270}},
|
|
|
|
|
{14,{TwSS::USLedger,PaperAlign::Rot0}},
|
|
|
|
|
{15,{TwSS::USLegal,PaperAlign::Rot0}},
|
|
|
|
|
{16,{TwSS::None,PaperAlign::Rot0}},
|
|
|
|
|
{17,{TwSS::USStatement,PaperAlign::Rot0}},
|
|
|
|
|
{18,{TwSS::MaxSize,PaperAlign::Rot0}}
|
|
|
|
|
};
|
2020-06-20 03:04:32 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef G300
|
|
|
|
|
static std::map<int, PaperStatus> paperStatusMap = {
|
|
|
|
|
{0,{TwSS::A4,PaperAlign::Rot0}},
|
|
|
|
|
{1,{TwSS::A5,PaperAlign::Rot0}},
|
|
|
|
|
{2,{TwSS::A6,PaperAlign::Rot0}},
|
2020-11-12 11:42:16 +00:00
|
|
|
|
//{3,{TwSS::B4,PaperAlign::Rot0}},
|
|
|
|
|
{3,{TwSS::B5,PaperAlign::Rot0}},
|
|
|
|
|
{4,{TwSS::B6,PaperAlign::Rot0}},
|
|
|
|
|
{5,{TwSS::USLetter,PaperAlign::Rot0}},
|
|
|
|
|
{6,{TwSS::USLegal,PaperAlign::Rot0}},
|
|
|
|
|
{7,{TwSS::None,PaperAlign::Rot0}},
|
2020-06-20 03:04:32 +00:00
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef G400
|
|
|
|
|
static std::map<int, PaperStatus> paperStatusMap = {
|
|
|
|
|
{0,{TwSS::A3,PaperAlign::Rot0}},
|
|
|
|
|
{1,{TwSS::A4,PaperAlign::Rot0}},
|
|
|
|
|
{2,{TwSS::A4,PaperAlign::Rot270}},
|
|
|
|
|
{3,{TwSS::A5,PaperAlign::Rot0}},
|
|
|
|
|
{4,{TwSS::A5,PaperAlign::Rot270}},
|
|
|
|
|
{5,{TwSS::A6,PaperAlign::Rot0}},
|
|
|
|
|
{6,{TwSS::A6,PaperAlign::Rot270}},
|
|
|
|
|
{7,{TwSS::B4,PaperAlign::Rot0}},
|
|
|
|
|
{8,{TwSS::B5,PaperAlign::Rot0}},
|
|
|
|
|
{9,{TwSS::B5,PaperAlign::Rot270}},
|
|
|
|
|
{10,{TwSS::B6,PaperAlign::Rot0}},
|
|
|
|
|
{11,{TwSS::B6,PaperAlign::Rot270}},
|
|
|
|
|
{12,{TwSS::USLetter,PaperAlign::Rot0}},
|
|
|
|
|
{13,{TwSS::USLetter,PaperAlign::Rot270}},
|
|
|
|
|
{14,{TwSS::USLedger,PaperAlign::Rot0}},
|
|
|
|
|
{15,{TwSS::USLegal,PaperAlign::Rot0}},
|
|
|
|
|
{16,{TwSS::None,PaperAlign::Rot0}},
|
|
|
|
|
{17,{TwSS::USStatement,PaperAlign::Rot0}},
|
|
|
|
|
{18,{TwSS::MaxSize,PaperAlign::Rot0}}
|
|
|
|
|
};
|
|
|
|
|
#endif
|
2020-03-11 01:58:06 +00:00
|
|
|
|
|
|
|
|
|
static std::map<int, int> filterMaps = {
|
|
|
|
|
{0,3},//不除色 None
|
|
|
|
|
{1,0},//除红
|
|
|
|
|
{2,1},//除绿
|
|
|
|
|
{3,2},//除蓝
|
|
|
|
|
{4,Enchace_Color::Enhance_Red},//红色增强
|
|
|
|
|
{5,Enchace_Color::Enhance_Green},//绿色增强
|
|
|
|
|
{6,Enchace_Color::Enhance_Blue}//蓝色增强
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//<index,res>
|
|
|
|
|
static std::map<int, float> resolutions = {
|
|
|
|
|
{0,100.0f},
|
|
|
|
|
{1,150.0f},
|
|
|
|
|
{2,200.0f},
|
|
|
|
|
{3,240.0f},
|
2020-11-16 10:05:04 +00:00
|
|
|
|
{4,300.0f},
|
|
|
|
|
{5,600.0f}
|
2020-03-11 01:58:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static std::map<int, unsigned short> colorModes = {
|
|
|
|
|
{0,TWPT_RGB},
|
|
|
|
|
{1,TWPT_GRAY},
|
|
|
|
|
{2,TWPT_BW}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static std::map<int, float> rotateDegrees = {
|
|
|
|
|
{0,0.0f},
|
|
|
|
|
{1,90.0f},
|
|
|
|
|
{2,180.0f},
|
|
|
|
|
{3,270.0f}
|
|
|
|
|
};
|
|
|
|
|
struct tagSCANCONFIGPARAM
|
|
|
|
|
{
|
|
|
|
|
UINT32 ColorModal;
|
|
|
|
|
UINT32 PaperSize;
|
|
|
|
|
FLOAT Resoulation;
|
|
|
|
|
UINT32 DuplexType;
|
|
|
|
|
BOOL IsDoubleFeeded;
|
|
|
|
|
BOOL IsBingdingDetectable;
|
|
|
|
|
BOOL SkrewDetectable;
|
|
|
|
|
BOOL Is10BitTure;
|
|
|
|
|
BOOL Is11BitTure;
|
|
|
|
|
BOOL Is12BitTure;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef tagSCANCONFIGPARAM SCANCONFIGPARAM, PSCANCONFIGPARAM;
|
|
|
|
|
|
|
|
|
|
struct tagIMAGEPROCESSPARAMS
|
|
|
|
|
{
|
|
|
|
|
UINT32 PaperSize;
|
|
|
|
|
BOOL IsDiscardBlankPage;
|
|
|
|
|
BOOL IsFlodPages;
|
|
|
|
|
INT Brightness;
|
|
|
|
|
INT Contrast;
|
|
|
|
|
INT Gamma;
|
|
|
|
|
INT Filter;
|
|
|
|
|
BOOL IsFillBlack;
|
|
|
|
|
BOOL IsAutoCrop;
|
|
|
|
|
INT ScanCount;
|
|
|
|
|
INT Orentation;
|
|
|
|
|
BOOL IsBackImageFlip180;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef tagIMAGEPROCESSPARAMS IMAGEPROCESSPARAMS, PIMAGEPROCESSPARAMS;
|
|
|
|
|
|
|
|
|
|
// CTwainUI 对话框
|
|
|
|
|
|
|
|
|
|
class CTwainUI : public CDialogEx
|
|
|
|
|
{
|
|
|
|
|
DECLARE_DYNAMIC(CTwainUI)
|
|
|
|
|
|
|
|
|
|
public:
|
2020-06-20 03:04:32 +00:00
|
|
|
|
CTwainUI(TwGlue glue,GScanCap caps,std::string confirmtitle,std::string hardwareversion,std::string serialnum, CWnd* pParent = nullptr); // 标准构造函数
|
2020-03-11 01:58:06 +00:00
|
|
|
|
virtual ~CTwainUI();
|
|
|
|
|
|
2020-06-20 03:04:32 +00:00
|
|
|
|
void UpdateUI();
|
2020-03-11 01:58:06 +00:00
|
|
|
|
void UpDateScanParam(PCONFIGPARAMS pConfigItem, bool updateDs = true);
|
|
|
|
|
void UpdateListConfig();
|
2020-06-20 03:04:32 +00:00
|
|
|
|
void GetGScanCap(GScanCap& cap);
|
2020-03-11 01:58:06 +00:00
|
|
|
|
void UpdateUi();
|
|
|
|
|
|
|
|
|
|
void EnableID_OKorID_Cancel(bool enable);
|
|
|
|
|
// 对话框数据
|
|
|
|
|
#ifdef AFX_DESIGN_TIME
|
|
|
|
|
enum { IDD = IDD_TWAINUI };
|
|
|
|
|
#endif
|
2020-03-17 13:02:50 +00:00
|
|
|
|
public:
|
|
|
|
|
std::string m_hardwareVersion;
|
|
|
|
|
std::string m_serialnum;
|
2020-03-11 01:58:06 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
|
|
|
virtual BOOL OnInitDialog();
|
|
|
|
|
|
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
|
afx_msg void OnBnClickedConfirm();
|
|
|
|
|
afx_msg void OnBnClickedBtndefault();
|
|
|
|
|
afx_msg void OnBnClickedCancel();
|
|
|
|
|
afx_msg void OnBnClickedBtnhelp();
|
|
|
|
|
afx_msg void OnBnClickedBtnbackupconfig();
|
|
|
|
|
afx_msg void OnBnClickedBtnsaveconfig();
|
|
|
|
|
afx_msg void OnBnClickedBtndeletconfig();
|
|
|
|
|
afx_msg void OnBnClickedBtnrecoveryconfig();
|
|
|
|
|
afx_msg void OnLbnSelchangeLstconfig();
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<CTabCtrlSSL> m_tabCtrl;
|
|
|
|
|
std::unique_ptr<CBasicPage> m_pageBasic;
|
|
|
|
|
std::unique_ptr<CFeedPaperPage> m_pageFeedPaper;
|
|
|
|
|
std::unique_ptr<CBrightnessPage> m_pageBrightness;
|
|
|
|
|
std::unique_ptr<CImageProcPage> m_pageImageProc;
|
2020-06-20 03:04:32 +00:00
|
|
|
|
public:
|
|
|
|
|
afx_msg void OnClose();
|
|
|
|
|
private:
|
|
|
|
|
void UpdateFilterCmbx();
|
|
|
|
|
void UpdateSharpenCmbx();
|
|
|
|
|
int getCmbDuplexIndex();
|
2020-03-11 01:58:06 +00:00
|
|
|
|
TwGlue m_glue;
|
|
|
|
|
|
|
|
|
|
std::vector<CONFIGINFO> cfi;
|
|
|
|
|
int getResolutionIndex(int resolution);
|
2020-06-20 03:04:32 +00:00
|
|
|
|
int getPaparSizeIndex(int papersize, int orentation);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
TwSS getcombox_ss(int index);
|
2020-03-11 01:58:06 +00:00
|
|
|
|
int getColorModelIndex(int pixtype);
|
2020-06-20 03:04:32 +00:00
|
|
|
|
int getRotateCmbIndex(float res);
|
2020-03-11 01:58:06 +00:00
|
|
|
|
std::vector<CONFIGINFO> getConfigFiles();
|
|
|
|
|
std::unique_ptr<GScanCap> settings;
|
2020-03-17 13:02:50 +00:00
|
|
|
|
std::string m_confirmtitle;
|
2020-06-20 03:04:32 +00:00
|
|
|
|
|
2020-09-21 01:25:46 +00:00
|
|
|
|
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
2020-03-11 01:58:06 +00:00
|
|
|
|
};
|