#pragma once #include #include "twglue.hpp" #include "CSaveConfigDlg.h" #include "Device/PublicFunc.h" #include "Device/PaperSize.h" #include #include "MapFinder.h" #include class CTabCtrlSSL; class CTabPageSSL; class CImageProcPage; class CBasicPage; class CFeedPaperPage; class CBrightnessPage; using std::vector; /*配置文件默认索引号*/ #define SUPPORTRESNUMS 6 //static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300,600}; #define TWPT_BW 0 #define TWPT_GRAY 1 #define TWPT_RGB 2 #ifdef G200 static std::map paperStatusMap = { {0,{TwSS::A3,PaperAlign::Rot0}}, {1,{TwSS::K8,PaperAlign::Rot0}}, {2,{TwSS::A4,PaperAlign::Rot0}}, {3,{TwSS::A4,PaperAlign::Rot270}}, {4,{TwSS::K16,PaperAlign::Rot0}}, {5,{TwSS::K16,PaperAlign::Rot270}}, {6,{TwSS::A5,PaperAlign::Rot0}}, {7,{TwSS::A5,PaperAlign::Rot270}}, {8,{TwSS::A6,PaperAlign::Rot0}}, {9,{TwSS::A6,PaperAlign::Rot270}}, {10,{TwSS::B4,PaperAlign::Rot0}}, {11,{TwSS::B5,PaperAlign::Rot0}}, {12,{TwSS::B5,PaperAlign::Rot270}}, {13,{TwSS::B6,PaperAlign::Rot0}}, {14,{TwSS::B6,PaperAlign::Rot270}}, {15,{TwSS::USLetter,PaperAlign::Rot0}}, {16,{TwSS::USLetter,PaperAlign::Rot270}}, {17,{TwSS::USLedger,PaperAlign::Rot0}}, {18,{TwSS::USLegal,PaperAlign::Rot0}}, {19,{TwSS::None,PaperAlign::Rot0}}, {20,{TwSS::USStatement,PaperAlign::Rot0}}, {21,{TwSS::MaxSize,PaperAlign::Rot0}}, {22,{TwSS::Trigeminy,PaperAlign::Rot0}} }; #endif #ifdef G300 static std::map paperStatusMap = { {0,{TwSS::A4,PaperAlign::Rot0}}, {1,{TwSS::K16,PaperAlign::Rot0}}, {2,{TwSS::A5,PaperAlign::Rot0}}, {3,{TwSS::A6,PaperAlign::Rot0}}, {4,{TwSS::B5,PaperAlign::Rot0}}, {5,{TwSS::B6,PaperAlign::Rot0}}, {6,{TwSS::USLetter,PaperAlign::Rot0}}, {7,{TwSS::USLegal,PaperAlign::Rot0}}, {8,{TwSS::None,PaperAlign::Rot0}}, }; #endif #ifdef G400 static std::map paperStatusMap = { {0,{TwSS::A3,PaperAlign::Rot0}}, {1,{TwSS::K8,PaperAlign::Rot0}}, {2,{TwSS::A4,PaperAlign::Rot0}}, {3,{TwSS::A4,PaperAlign::Rot270}}, {4,{TwSS::K16,PaperAlign::Rot0}}, {5,{TwSS::K16,PaperAlign::Rot270}}, {6,{TwSS::A5,PaperAlign::Rot0}}, {7,{TwSS::A5,PaperAlign::Rot270}}, {8,{TwSS::A6,PaperAlign::Rot0}}, {9,{TwSS::A6,PaperAlign::Rot270}}, {10,{TwSS::B4,PaperAlign::Rot0}}, {11,{TwSS::B5,PaperAlign::Rot0}}, {12,{TwSS::B5,PaperAlign::Rot270}}, {13,{TwSS::B6,PaperAlign::Rot0}}, {14,{TwSS::B6,PaperAlign::Rot270}}, {15,{TwSS::USLetter,PaperAlign::Rot0}}, {16,{TwSS::USLetter,PaperAlign::Rot270}}, {17,{TwSS::USLedger,PaperAlign::Rot0}}, {18,{TwSS::USLegal,PaperAlign::Rot0}}, {19,{TwSS::None,PaperAlign::Rot0}}, {20,{TwSS::USStatement,PaperAlign::Rot0}}, {21,{TwSS::MaxSize,PaperAlign::Rot0}}, {22,{TwSS::Trigeminy,PaperAlign::Rot0}} }; #endif static std::map 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}//蓝色增强 }; // //static std::map resolutions = { // {0,100.0f}, // {1,150.0f}, // {2,200.0f}, // {3,240.0f}, // {4,300.0f}, // {5,600.0f} //}; static std::map colorModes = { {0,TWPT_RGB}, {1,TWPT_GRAY}, {2,TWPT_BW} }; static std::map 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: CTwainUI(TwGlue glue,GScanCap caps,std::string confirmtitle,std::string hardwareversion,std::string serialnum, CWnd* pParent = nullptr); // 标准构造函数 virtual ~CTwainUI(); void UpdateUI(); void UpDateScanParam(PCONFIGPARAMS pConfigItem, bool updateDs = true); void UpdateListConfig(); void GetGScanCap(GScanCap& cap); void UpdateUi(); void setvisable_size(bool flag); void setvisable_sleepmode(bool flag); void EnableID_OKorID_Cancel(bool enable); // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_TWAINUI }; #endif public: std::string m_hardwareVersion; std::string m_serialnum; 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 m_tabCtrl; std::unique_ptr m_pageBasic; std::unique_ptr m_pageFeedPaper; std::unique_ptr m_pageBrightness; std::unique_ptr m_pageImageProc; public: afx_msg void OnClose(); private: void UpdateFilterCmbx(); void UpdateSharpenCmbx(); int getCmbDuplexIndex(); TwGlue m_glue; std::vector cfi; //int getResolutionIndex(int resolution); int getPaparSizeIndex(int papersize, int orentation); TwSS getcombox_ss(int index); int getColorModelIndex(int pixtype); int getRotateCmbIndex(float res); std::vector getConfigFiles(); std::unique_ptr settings; std::string m_confirmtitle; virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); };