The following header seems to hang WTLHelper:
#pragma once
#include "view.h"
#include "pagecombobox.h"
#include "toolbarhelper.h"
#include "barcodereader.h"
class CMainFrame :
public CFrameWindowImpl<CMainFrame>,
public CUpdateUI<CMainFrame>,
public CMessageFilter,
public CIdleHandler,
public CPrintJobInfo,
public CToolbarHelper<CMainFrame>
{
private:
static UINT WM_DISPLAYTIFF;
static UINT WM_STARTSCAN;
static UINT WM_CONTINUESCAN;
static UINT WM_ENDSCAN;
static UINT WM_SCANREADDATA;
static UINT WM_PRINTSETUP;
static UINT WM_PRINTTIFF;
static UINT WM_ENABLEKVIEW;
static UINT WM_EXITKVIEW;
static UINT WM_INITTWAIN;
static UINT WM_TWAINSTATUS;
static UINT WM_SETINACQUIRE;
static LPCTSTR MF_PRINTJOB;
static LPCTSTR MF_MRU_KEY;
static LPCTSTR KVIEW2_CLASSNAME;
static LPCTSTR MF_TEMPFILEPREFIX;
static LPCTSTR REG_SETTINGS;
static LPCTSTR REG_MINIMIZE;
static LPCTSTR REG_DITHER;
static LPCTSTR REG_DITHER_METHOD;
static LPCTSTR REG_SAVE_IMAGE;
static LPCTSTR REG_STRETCH;
static LPCTSTR REG_ZOOM;
static LPCTSTR REG_MINIMIZESCANNER;
static LPCTSTR REG_LEFTCLICK;
static LPCTSTR REG_RIGHTCLICK;
static LPCTSTR REG_REBAR;
static LPCTSTR REG_COMPRESSIONBW;
static LPCTSTR REG_COMPRESSIONCOL;
static LPCTSTR REG_JPEGQUALITY;
static LPCTSTR REG_BARCODE_SETTINGS;
static LPCTSTR REG_BARCODE_TYPES;
static LPCTSTR REG_BARCODE_MULTIPLE;
static LPCTSTR REG_BARCODE_NOISE_REDUCTION;
static LPCTSTR REG_BARCODE_CHECK_EVERY;
static LPCTSTR REG_BARCODE_OVER_SAMPLING;
static LPCTSTR REG_BARCODE_SKEW_TOLERANCE;
static LPCTSTR REG_BARCODE_COLOR_THRESHOLD;
enum
{
MF_FILE_MENU_POSITION = 0,
MF_RECENT_MENU_POSITION = 12,
MF_MRU_MAX = 12,
MF_DEFMARGIN = 1000,
};
enum
{
m_ePageComboWidth = 12,
m_ePageComboHeight = 16
};
enum EPage
{
pageCancel,
pageCurrent,
pageAll,
};
class CEnumData
{
public:
HWND m_hWnd;
UINT m_nFlags;
public:
CEnumData(HWND hWnd, UINT nFlags)
: m_hWnd(hWnd)
, m_nFlags(nFlags)
{
}
};
public:
DECLARE_FRAME_WND_CLASS(KVIEW2_CLASSNAME, IDR_MAINFRAME);
CMainFrame(void);
~CMainFrame(void);
static LPCTSTR REG_WINDOWSETTINGS;
static LPCTSTR REG_WINDOWFRAME;
CCommandBarCtrl m_CmdBar;
CKView2View m_view;
CPrinter m_oPrinter;
CDevMode m_oDevMode;
CRect m_rcMargin;
CRecentDocumentList m_oMRU;
CString m_strFileName;
CMultiPaneStatusBarCtrl m_wndStatusBar;
CPageComboBox m_wndPageCombo;
bool m_bScanReadData;
CAutoVectorPtr<BYTE> m_pScanData;
BYTE* m_pScanDataPtr;
DWORD m_dwScanDataSize;
BOOL m_bEnabled;
BOOL m_bMinimize;
BOOL m_bDither;
int m_nDitherMethod;
int m_nSaveImage;
BOOL m_bStretch;
int m_nZoom;
BOOL m_bMinimizeScanner;
Barcode::CBarcodeReader m_barcode;
Barcode::CBarcodeData m_barcode_data;
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
virtual bool IsValidPage(UINT nPage);
virtual bool PrintPage(UINT nPage, HDC hDC);
void UpdateUI();
void UpdateStatusBar();
void TogglePrintPreview();
void UpdateTitleBar(LPCTSTR lpsz = NULL);
void NormalSize();
EPage ApplyToAllPages(UINT nID);
void CreatePageComboBox(HWND hWndToolBar);
CSize GetDefaultGUIFontSize() const;
void LoadFile(LPCTSTR lpsz);
static BOOL CALLBACK EnumThreadWndProc(HWND hWnd, LPARAM lParam);
BOOL DoFilePageSetup();
void DeleteScanData();
BEGIN_UPDATE_UI_MAP(CMainFrame)
UPDATE_ELEMENT(ID_VIEW_TOOLBAR, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_IMAGETOOLBAR, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_STATUS_BAR, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_PRINT_PREVIEW, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_FILE_PRINT, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_VIEW_SIZEWINDOWTOIMAGE, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_PAGE_SETUP, UPDUI_MENUPOPUP|UPDUI_TOOLBAR)
UPDATE_ELEMENT(ID_FILE_SAVE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_SAVE_AS, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_SAVE_CURRENT_PAGE_AS, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_ACQUIRE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_FILE_SELECTSOURCE, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_COPY, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_PASTE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_ZOOMIN, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_ZOOMOUT, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_STRETCH, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_NORMALSIZE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_FLIP, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_MIRROR, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_GREYSCALE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_ROTATE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_DITHER, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_DECREASECOLOURS, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_INCREASECOLOURS, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_NEXTPAGE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_PREVPAGE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_FIRSTPAGE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_LASTPAGE, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_FITWIDTH, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_FITHEIGHT, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_VIEW_BESTFIT, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_EDIT_UNDO, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_APP_EXIT, UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_PROPERTIES, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
UPDATE_ELEMENT(ID_IMAGE_BARCODES, UPDUI_TOOLBAR|UPDUI_MENUPOPUP)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CMainFrame)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_DISPLAYTIFF, OnDisplayTIFF)
MESSAGE_HANDLER(WM_STARTSCAN, OnStartScan)
MESSAGE_HANDLER(WM_CONTINUESCAN, OnContinueScan)
MESSAGE_HANDLER(WM_ENDSCAN, OnEndScan)
MESSAGE_HANDLER(WM_SCANREADDATA, OnScanReadData)
MESSAGE_HANDLER(WM_PRINTSETUP, OnPrintSetup)
MESSAGE_HANDLER(WM_PRINTTIFF, OnPrintTIFF)
MESSAGE_HANDLER(WM_ENABLEKVIEW, OnEnableKView)
MESSAGE_HANDLER(WM_EXITKVIEW, OnExitKView)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
MESSAGE_HANDLER(WM_INITTWAIN, OnInitTWAIN)
MESSAGE_HANDLER(WM_TWAINSTATUS, OnTWAINStatus)
MESSAGE_HANDLER(WM_SETINACQUIRE, OnSetInAcquire)
COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
COMMAND_ID_HANDLER(ID_VIEW_TOOLBAR, OnViewToolBar)
COMMAND_ID_HANDLER(ID_VIEW_STATUS_BAR, OnViewStatusBar)
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
COMMAND_ID_HANDLER(ID_FILE_SELECTSOURCE, OnFileSelectSource)
COMMAND_ID_HANDLER(ID_FILE_ACQUIRE, OnFileAcquire)
COMMAND_ID_HANDLER(ID_VIEW_SIZEWINDOWTOIMAGE, OnViewSizeToImage)
COMMAND_ID_HANDLER(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview);
COMMAND_ID_HANDLER(ID_FILE_PRINT, OnFilePrint)
COMMAND_ID_HANDLER(ID_FILE_PAGE_SETUP, OnFilePageSetup)
COMMAND_ID_HANDLER(ID_FILE_OPEN, OnFileOpen)
COMMAND_ID_HANDLER(ID_FILE_SAVE, OnFileSave)
COMMAND_ID_HANDLER(ID_FILE_SAVE_AS, OnFileSaveAs)
COMMAND_ID_HANDLER(ID_FILE_SAVE_CURRENT_PAGE_AS, OnFileSaveCurrentPageAs)
COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy)
COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste)
COMMAND_ID_HANDLER(ID_VIEW_ZOOMIN, OnViewZoomIn)
COMMAND_ID_HANDLER(ID_VIEW_ZOOMOUT, OnViewZoomOut)
COMMAND_ID_HANDLER(ID_VIEW_STRETCH, OnViewStretch)
COMMAND_ID_HANDLER(ID_VIEW_NORMALSIZE, OnViewNormal)
COMMAND_ID_HANDLER(ID_IMAGE_FLIP, OnImageFlip)
COMMAND_ID_HANDLER(ID_IMAGE_MIRROR, OnImageMirror)
COMMAND_ID_HANDLER(ID_IMAGE_GREYSCALE, OnImageGreyScale)
COMMAND_ID_HANDLER(ID_IMAGE_ROTATE, OnImageRotate)
COMMAND_ID_HANDLER(ID_IMAGE_DITHER, OnImageDither)
COMMAND_ID_HANDLER(ID_IMAGE_DECREASECOLOURS, OnImageDecrease)
COMMAND_ID_HANDLER(ID_IMAGE_INCREASECOLOURS, OnImageIncrease)
COMMAND_ID_HANDLER(ID_VIEW_FIRSTPAGE, OnViewFirstPage)
COMMAND_ID_HANDLER(ID_VIEW_NEXTPAGE, OnViewNextPage)
COMMAND_ID_HANDLER(ID_VIEW_PREVPAGE, OnViewPrevPage)
COMMAND_ID_HANDLER(ID_VIEW_LASTPAGE, OnViewLastPage)
COMMAND_ID_HANDLER(ID_VIEW_FITWIDTH, OnViewFitWidth)
COMMAND_ID_HANDLER(ID_VIEW_FITHEIGHT, OnViewFitHeight)
COMMAND_ID_HANDLER(ID_VIEW_BESTFIT, OnViewBestFit)
COMMAND_ID_HANDLER(ID_TOOLS_OPTIONS, OnToolsOptions)
COMMAND_ID_HANDLER(ID_HELP_KEYBOARDMAP, OnHelpKeyboardMap)
COMMAND_ID_HANDLER(ID_IMAGE_PROPERTIES, OnImageProperties)
COMMAND_HANDLER(ID_VIEW_PAGE, CBN_SELCHANGE, OnSelChangePage)
COMMAND_RANGE_HANDLER(ID_FILE_MRU_FIRST, ID_FILE_MRU_LAST, OnFileRecent)
NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnToolbarDropDown)
COMMAND_ID_HANDLER(ID_IMAGE_BARCODES, OnImageBarcodes)
CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnDestroy(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnDisplayTIFF(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnStartScan(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnContinueScan(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnEndScan(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnScanReadData(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnPrintSetup(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnPrintTIFF(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnEnableKView(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnExitKView(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnInitTWAIN(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnTWAINStatus(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnSetInAcquire(UINT , WPARAM wParam, LPARAM , BOOL& );
LRESULT OnSize(UINT , WPARAM wParam, LPARAM , BOOL& );
LRESULT OnContextMenu(UINT , WPARAM wParam, LPARAM , BOOL& );
LRESULT OnClose(UINT , WPARAM wParam, LPARAM , BOOL& );
LRESULT OnFileExit(WORD , WORD , HWND , BOOL& );
LRESULT OnViewToolBar(WORD , WORD , HWND , BOOL& );
LRESULT OnViewStatusBar(WORD , WORD , HWND , BOOL& );
LRESULT OnAppAbout(WORD , WORD , HWND , BOOL& );
LRESULT OnFileSelectSource(WORD , WORD , HWND , BOOL& );
LRESULT OnFileAcquire(WORD , WORD , HWND , BOOL& );
LRESULT OnViewSizeToImage(WORD , WORD , HWND , BOOL& );
LRESULT OnFilePrintPreview(WORD , WORD , HWND , BOOL& );
LRESULT OnFilePrint(WORD , WORD , HWND , BOOL& );
LRESULT OnFilePageSetup(WORD , WORD , HWND , BOOL& );
LRESULT OnFileOpen(WORD , WORD , HWND , BOOL& );
LRESULT OnFileRecent(WORD , WORD , HWND , BOOL& );
LRESULT OnFileSave(WORD , WORD , HWND , BOOL& );
LRESULT OnFileSaveAs(WORD , WORD , HWND , BOOL& );
LRESULT OnFileSaveCurrentPageAs(WORD , WORD , HWND , BOOL& );
LRESULT OnEditCopy(WORD , WORD , HWND , BOOL& );
LRESULT OnEditPaste(WORD , WORD , HWND , BOOL& );
LRESULT OnViewZoomIn(WORD , WORD , HWND , BOOL& );
LRESULT OnViewZoomOut(WORD , WORD , HWND , BOOL& );
LRESULT OnViewStretch(WORD , WORD , HWND , BOOL& );
LRESULT OnViewNormal(WORD , WORD , HWND , BOOL& );
LRESULT OnImageFlip(WORD , WORD , HWND , BOOL& );
LRESULT OnImageMirror(WORD , WORD , HWND , BOOL& );
LRESULT OnImageGreyScale(WORD , WORD , HWND , BOOL& );
LRESULT OnImageRotate(WORD , WORD , HWND , BOOL& );
LRESULT OnImageDither(WORD , WORD , HWND , BOOL& );
LRESULT OnImageDecrease(WORD , WORD , HWND , BOOL& );
LRESULT OnImageIncrease(WORD , WORD , HWND , BOOL& );
LRESULT OnViewFirstPage(WORD , WORD , HWND , BOOL& );
LRESULT OnViewNextPage(WORD , WORD , HWND , BOOL& );
LRESULT OnViewPrevPage(WORD , WORD , HWND , BOOL& );
LRESULT OnViewLastPage(WORD , WORD , HWND , BOOL& );
LRESULT OnViewFitWidth(WORD , WORD , HWND , BOOL& );
LRESULT OnViewFitHeight(WORD , WORD , HWND , BOOL& );
LRESULT OnViewBestFit(WORD , WORD , HWND , BOOL& );
LRESULT OnSelChangePage(WORD , WORD , HWND , BOOL& );
LRESULT OnToolsOptions(WORD , WORD , HWND , BOOL& );
LRESULT OnHelpKeyboardMap(WORD , WORD , HWND , BOOL& );
LRESULT OnImageProperties(WORD , WORD , HWND , BOOL& );
LRESULT OnToolbarDropDown(int , LPNMHDR , BOOL& );
LRESULT OnImageBarcodes(WORD , WORD , HWND , BOOL& );
};
The Rob Blog
|