// MarkOptions.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "MarkOptions.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMarkOptions dialog CMarkOptions::CMarkOptions(ILEADRasterDocument* pLRasterDoc, CWnd* pParent /*=NULL*/) : CDialog(CMarkOptions::IDD, pParent) { //{{AFX_DATA_INIT(CMarkOptions) m_nColorOpt = -1; //}}AFX_DATA_INIT m_pLRasterDoc = pLRasterDoc; memset(m_uColor, 0, sizeof(m_uColor)); for(int i=0; i<4; i++) m_pItems[i] = new int[5]; } 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); DDX_CBIndex(pDX, IDC_CMB_COLOR_OPTION, m_nColorOpt); //}}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::OnSelchangeListColor() { int nSelCount = 0; int nColorIndex = m_cmbColorOpt.GetCurSel(); nSelCount = m_lstColor.GetSelCount(); m_lstColor.GetSelItems(nSelCount, m_pItems[nColorIndex]); m_uColor[nColorIndex] = 0; for (int i=0; i= 0) ? true : false); } void CMarkOptions::OnOK() { UpdateData(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->ColorSuspectCharacter = m_uColor[0]; m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->ColRejectionSymbol = m_uColor[1]; m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->ColMissingSymbol = m_uColor[2]; m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->ColSuspectWord = m_uColor[3]; CString csText; BSTR bstrText; m_edtSuspectCharacter.GetWindowText (csText); bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->PutSeparatorBeforeSuspectCharacter(bstrText); SysFreeString(bstrText); m_edtRejectionSymbol.GetWindowText (csText); bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorBeforeRejectionSymbol = bstrText; SysFreeString(bstrText); m_edtMissingSymbol.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorBeforeMissingSymbol = bstrText; SysFreeString(bstrText); m_edtSeparatorWordStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartSuspectWord = bstrText; SysFreeString(bstrText); m_edtSeparatorWordStartEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndSuspectWord = bstrText; SysFreeString(bstrText); m_edtSeparatorPageStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartPage = bstrText; SysFreeString(bstrText); m_edtSeparatorPageEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndPage = bstrText; SysFreeString(bstrText); m_edtSeparatorLineStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartLine = bstrText; SysFreeString(bstrText); m_edtSeparatorLineEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndLine = bstrText; SysFreeString(bstrText); m_edtSeparatorTableRowStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartTableRow = bstrText; SysFreeString(bstrText); m_edtSeparatorTableRowEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndTableRow = bstrText; SysFreeString(bstrText); m_edtSeparatorParagraphStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartParagraph = bstrText; SysFreeString(bstrText); m_edtSeparatorParagraphEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndParagraph = bstrText; SysFreeString(bstrText); m_edtSeparatorZoneStart.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorStartZone = bstrText; SysFreeString(bstrText); m_edtSeparatorZoneEnd.GetWindowText ( csText ) ; bstrText = csText.AllocSysString(); m_pLRasterDoc->GetResultOptions()->GetMarkOptions()->SeparatorEndZone = bstrText; SysFreeString(bstrText); for(int i=0; i<4; i++) delete[] m_pItems[i]; CDialog::OnOK(); }