// MarkOpts.cpp : implementation file // #include "stdafx.h" #include "ocrutil.h" #include "MarkOpts.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMarkOptions dialog CMarkOptions::CMarkOptions(pMARKOPTIONS pMarkOpts, CWnd* pParent /*=NULL*/) : CDialog(CMarkOptions::IDD, pParent) { //{{AFX_DATA_INIT(CMarkOptions) //}}AFX_DATA_INIT m_pMarkOpts = pMarkOpts; memset(m_uColor, 0, sizeof(m_uColor)); } void CMarkOptions::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMarkOptions) DDX_Control(pDX, IDC_LIST_COLOR, m_lstColor); DDX_Control(pDX, IDC_CMB_COLOR_OPTION, m_cmbColorOpt); //}}AFX_DATA_MAP DDX_Control(pDX, IDC_EDIT_SEP_BEF_SUS_CHAR, m_edtSuspectCharacter ) ; DDX_Control(pDX, IDC_EDIT_SEP_BEF_REJECT_SYMBOL, m_edtRejectionSymbol ) ; DDX_Control(pDX, IDC_EDIT_SEP_BEF_MISSING_SYMBOL, m_edtMissingSymbol ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_WORD, m_edtSeparatorWordStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_WORD, m_edtSeparatorWordStartEnd ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_LINE, m_edtSeparatorLineStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_LINE, m_edtSeparatorLineEnd ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_PARAG, m_edtSeparatorParagraphStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_PARAG, m_edtSeparatorParagraphEnd ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_PAGE, m_edtSeparatorPageStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_PAGE, m_edtSeparatorPageEnd ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_TABLE_ROW, m_edtSeparatorTableRowStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_TABLE_ROW, m_edtSeparatorTableRowEnd ) ; DDX_Control(pDX, IDC_EDIT_SEP_START_ZONE, m_edtSeparatorZoneStart ) ; DDX_Control(pDX, IDC_EDIT_SEP_END_ZONE, m_edtSeparatorZoneEnd ) ; } BEGIN_MESSAGE_MAP(CMarkOptions, CDialog) //{{AFX_MSG_MAP(CMarkOptions) ON_CBN_SELCHANGE(IDC_CMB_COLOR_OPTION, OnSelchangeCmbColorOption) ON_LBN_SELCHANGE(IDC_LIST_COLOR, OnSelchangeListColor) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMarkOptions message handlers BOOL CMarkOptions::OnInitDialog() { CDialog::OnInitDialog(); m_lstColor.AddString(TEXT("None")); m_lstColor.AddString(TEXT("Blue")); m_lstColor.AddString(TEXT("Green")); m_lstColor.AddString(TEXT("Red")); m_lstColor.AddString(TEXT("Intensive")); m_lstColor.SetItemData(0, COLOR_NONE); m_lstColor.SetItemData(1, COLOR_BLUE); m_lstColor.SetItemData(2, COLOR_GREEN); m_lstColor.SetItemData(3, COLOR_RED); m_lstColor.SetItemData(4, COLOR_INTENSIVE); m_edtSuspectCharacter.SetWindowText ( _T ( "" ) ) ; m_edtRejectionSymbol.SetWindowText ( _T ( "" ) ) ; m_edtMissingSymbol.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorWordStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorWordStartEnd.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorLineStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorLineEnd.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorParagraphStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorParagraphEnd.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorPageStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorPageEnd.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorTableRowStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorTableRowEnd.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorZoneStart.SetWindowText ( _T ( "" ) ) ; m_edtSeparatorZoneEnd.SetWindowText ( _T ( "" ) ) ; m_cmbColorOpt.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CMarkOptions::OnSelchangeCmbColorOption() { L_INT nColorIndex = m_cmbColorOpt.GetCurSel(); m_lstColor.SetSel(0, ((m_uColor[nColorIndex] & COLOR_NONE) == COLOR_NONE)); m_lstColor.SetSel(1, ((m_uColor[nColorIndex] & COLOR_BLUE) == COLOR_BLUE)); m_lstColor.SetSel(2, ((m_uColor[nColorIndex] & COLOR_GREEN) == COLOR_GREEN)); m_lstColor.SetSel(3, ((m_uColor[nColorIndex] & COLOR_RED) == COLOR_RED)); m_lstColor.SetSel(4, ((m_uColor[nColorIndex] & COLOR_INTENSIVE) == COLOR_INTENSIVE)); } void CMarkOptions::OnOK() { UpdateData(); m_pMarkOpts->uColSuspCharacter = m_uColor[0]; m_pMarkOpts->uColRejectionSymbol = m_uColor[1]; m_pMarkOpts->uColMissingSymbol = m_uColor[2]; m_pMarkOpts->uColSuspWord = m_uColor[3]; CString csText; BSTR bstrText; m_edtSuspectCharacter.GetWindowText (csText); bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepBeforeSuspCharacter, bstrText); SysFreeString(bstrText); m_edtRejectionSymbol.GetWindowText (csText); bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepBeforeRejectionSymbol, bstrText); SysFreeString(bstrText); m_edtMissingSymbol.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepBeforeMissingSymbol, bstrText); SysFreeString(bstrText); m_edtSeparatorWordStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofSuspWord, bstrText); SysFreeString(bstrText); m_edtSeparatorWordStartEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofSuspWord, bstrText); SysFreeString(bstrText); m_edtSeparatorPageStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofPage, bstrText); SysFreeString(bstrText); m_edtSeparatorPageEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofPage, bstrText); SysFreeString(bstrText); m_edtSeparatorLineStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofLine, bstrText); SysFreeString(bstrText); m_edtSeparatorLineEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofLine, bstrText); SysFreeString(bstrText); m_edtSeparatorTableRowStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofTableRow, bstrText); SysFreeString(bstrText); m_edtSeparatorTableRowEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofTableRow, bstrText); SysFreeString(bstrText); m_edtSeparatorParagraphStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofPara, bstrText); SysFreeString(bstrText); m_edtSeparatorParagraphEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofPara, bstrText); SysFreeString(bstrText); m_edtSeparatorZoneStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepStartofZone, bstrText); SysFreeString(bstrText); m_edtSeparatorZoneEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); wcscpy(m_pMarkOpts->szSepEndofZone, bstrText); SysFreeString(bstrText); CDialog::OnOK(); } void CMarkOptions::OnSelchangeListColor() { L_INT nSelCount = 0; L_INT nItem[5]; L_INT nColorIndex = m_cmbColorOpt.GetCurSel(); nSelCount = m_lstColor.GetSelCount(); m_lstColor.GetSelItems(nSelCount, nItem); m_uColor[nColorIndex] = 0; for (int i=0; i