DlgInput.cpp
上传用户:bingyunhe
上传日期:2013-07-06
资源大小:723k
文件大小:41k
-
/*! @file DlgInput.cpp
brief
文件功能: 输入对话框的实现文件 ,在没有真实键盘的情况下,实现各种输入 <br>
<br>
文件名称: DlgInput.cpp <br>
模块名 : 输入法 <br>
author zqp
version 1.0.0
remark <br>
修改记录 : <br>
日 期 版本 修改人 修改内容<br>
2005/06/13 1.0.0 zqp 创建 <br>
******************************************************************************** <br>
版权:浙江昆仑科技有限公司 保留所有权利
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
- // DlgInput.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "ChineseInputer.h"
- #include "DlgInput.h"
- #include <atltime.h>
- #include ".dlginput.h"
- // CDlgInput 对话框
- IMPLEMENT_DYNAMIC(CDlgInput, CDialog)
- CDlgInput::CDlgInput(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgInput::IDD, pParent)
- , m_strChar(_T(""))
- , m_strInput(_T(""))
- , m_bSpell(FALSE)
- , m_bNum(TRUE)
- , m_bChar(TRUE)
- , m_bStrokeOrder(TRUE)
- , m_bLower(FALSE)
- , m_bUpper(TRUE )
-
- {
- m_Inputer.SetMode(ChineseInputer::Inputer::Input_Spell) ;
- m_bKillThread = FALSE ;
- m_bLock = FALSE ;
- }
- CDlgInput::~CDlgInput( )
- {
-
- HANDLE hWinThread = m_pWinThread->m_hThread ;
- m_bKillThread = TRUE ;
- int ret = WaitForSingleObject(hWinThread ,5000) ;
- if ( ret == WAIT_FAILED )
- AfxMessageBox("结束线程出错!") ;
- enumer.clear( ) ;
-
-
- //free(&m_Dic ) ;
-
- }
- void CDlgInput::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_LIST, m_lsList);
- DDX_Text(pDX, IDC_STCCHAR, m_strChar);
- DDX_Control(pDX, IDC_BTNHOME, m_btnHome);
- DDX_Control(pDX, IDC_BUTTON1, m_btnB1);
- DDX_Control(pDX, IDC_BTNUPGAGE, m_btnUpPage);
- DDX_Control(pDX, IDC_BTNDOWNGAGE, m_btnDownPage);
- DDX_Control(pDX, IDC_BTNEND, m_btnEnd);
- DDX_Control(pDX, IDC_BTNBACk, m_btnBack);
- DDX_Radio(pDX, IDC_RADSPELL, m_bSpell);
- DDX_Radio(pDX, IDC_RADNUM, m_bNum);
- DDX_Radio(pDX, IDC_RADCHAR, m_bChar);
- DDX_Radio(pDX, IDC_RADSTROKEORDER, m_bStrokeOrder);
- DDX_Radio(pDX, IDC_RADUPPER, m_bUpper);
- DDX_Radio(pDX, IDC_RADLOWER, m_bLower);
- DDX_Text(pDX, IDC_EDTIN, m_strInput);
- DDX_Control(pDX, IDC_EDTIN, m_edtIn);
- }
- BEGIN_MESSAGE_MAP(CDlgInput, CDialog)
- // ON_WM_KEYUP()
- // ON_WM_SYSKEYUP()
- // ON_WM_CHAR()
- // ON_WM_KEYDOWN()
- ON_LBN_DBLCLK(IDC_LIST, OnLbnDblclkList)
- // ON_LBN_SELCHANGE(IDC_LIST, OnLbnSelchangeList)
- ON_BN_CLICKED(IDC_BTN1, OnBnClickedBtn1)
- ON_BN_CLICKED(IDC_BTN2, OnBnClickedBtn2)
- ON_BN_CLICKED(IDC_BTN3, OnBnClickedBtn3)
- ON_BN_CLICKED(IDC_BTN4, OnBnClickedBtn4)
- ON_BN_CLICKED(IDC_BTN5, OnBnClickedBtn5)
- ON_BN_CLICKED(IDC_BTN6, OnBnClickedBtn6)
- ON_BN_CLICKED(IDC_BTN7, OnBnClickedBtn7)
- ON_BN_CLICKED(IDC_BTN8, OnBnClickedBtn8)
- ON_BN_CLICKED(IDC_BTN9, OnBnClickedBtn9)
- ON_BN_CLICKED(IDC_BTNHOME, OnBnClickedBtnhome)
- ON_BN_CLICKED(IDC_BTNDOWNGAGE, OnBnClickedBtndowngage)
- ON_BN_CLICKED(IDC_BTNEND, OnBnClickedBtnend)
- ON_BN_CLICKED(IDC_BTNUPGAGE, OnBnClickedBtnupgage)
- ON_BN_CLICKED(IDC_RADSPELL, OnBnClickedRadspell)
- ON_BN_CLICKED(IDC_RADNUM, OnBnClickedRadnum)
- ON_BN_CLICKED(IDC_RADCHAR, OnBnClickedRadchar)
- ON_BN_CLICKED(IDC_RADSTROKEORDER, OnBnClickedRadstrokeorder)
- ON_BN_CLICKED(IDC_BTN10, OnBnClickedBtn10)
- ON_BN_CLICKED(IDC_BTNBACk, OnBnClickedBtnback)
- ON_BN_CLICKED(IDC_BTNLEFT, OnBnClickedBtnleft)
- ON_BN_CLICKED(IDC_BTNRIGHT, OnBnClickedBtnright)
- ON_EN_SETFOCUS(IDC_EDTIN, OnEnSetfocusEdtin)
- ON_EN_KILLFOCUS(IDC_EDTIN, OnEnKillfocusEdtin)
- ON_LBN_SELCHANGE(IDC_LIST, OnLbnSelchangeList)
- ON_EN_MAXTEXT(IDC_EDTIN, OnEnMaxtextEdtin)
- ON_BN_CLICKED(IDC_BTN11, OnBnClickedBtn11)
- ON_BN_CLICKED(IDC_RADUPPER, OnBnClickedRadupper)
- ON_BN_CLICKED(IDC_RADLOWER, OnBnClickedRadlower)
- ON_BN_CLICKED(IDC_BTNOK, OnBnClickedBtnok)
- END_MESSAGE_MAP( )
- BOOL CDlgInput::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: 在此添加专用代码和/或调用基类
- int nChar;
- CString strStrokeOrder = "一丨丿丶乙" ;
- CString strFilter ;
-
- if ( pMsg->message == WM_LBUTTONDOWN )
- {
- CPoint pos = pMsg->pt ;
- RECT rInput ;
- m_edtIn.GetWindowRect(&rInput) ;
-
- //CPoint pInput =
-
- if ( ( pos.x >= rInput.left) && (pos.x <= rInput.right )
- &&(pos.y >= rInput.top ) && ( pos.y <= rInput.bottom ) )
- {
- return TRUE ; //不需要再处理
- }
- else //不是在此矩形框内,转发此消息
- {
- return CDialog::PreTranslateMessage(pMsg) ;
- }
- }
- else if ( (pMsg->message != WM_KEYUP ) && ( pMsg->message != WM_KEYDOWN )
- && (pMsg->message != WM_CHAR ) )
- {
- return CDialog::PreTranslateMessage(pMsg) ; //转发其它消息
- }
- else
- {
- nChar = pMsg->wParam ;
- if( ( nChar >= 65 && nChar <= 90) || ( nChar >= 48 && nChar <= 57 )
- || (nChar == 8 ) || ( nChar == 37 ) || ( nChar == 39 ) )
- {
- if (pMsg->message == WM_KEYUP )
- {
-
- TCHAR cChar = pMsg->wParam ;
-
- //是向前删除键
- if ( nChar == 8 )
- {
- int al = m_strChar.GetLength( ) ;
- if ( m_nMode == StrokesOrder_Mode ) //!笔顺输入模式
- al = (int) al/2 ;
- if ( al > 1 )
- {
- if (m_nMode == 0) //!拼音输入模式
- {
- m_strChar = m_strChar.Left(m_strChar.GetLength() -1 ) ;
- m_Inputer.Reset( ) ;
- m_Inputer.Put(_T(m_strChar) ) ;
- }
- else if (m_nMode == StrokesOrder_Mode) //!笔顺输入模式
- {
- m_strChar = m_strChar.Left(m_strChar.GetLength() - 2 ) ;
- m_strOrderFilter = m_strOrderFilter.Left(m_strOrderFilter.GetLength() -1 ) ;
- m_Inputer.Reset( ) ;
- m_Inputer.Put(_T(m_strOrderFilter) ) ;
- }
- }
- else if (al == 1)
- {
- m_strChar ="" ;
- m_strOrderFilter ="" ;
- m_Inputer.Reset( ) ;
- m_lsList.ResetContent( ) ;
- this->UpdateData(FALSE) ;
- return TRUE ;
- }
- else
- {
- CDialog::PreTranslateMessage(pMsg) ;
- this->UpdateData( TRUE ) ;
- return FALSE ;
- }
- }
- else if (( nChar == 37 ) || ( nChar == 39 ) ) //左右箭头键
- {
- if ( nChar == 37 )
- {
- if (m_nCount == 0 )
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount) ;
- return TRUE ;
- }
- char cCount = m_strInput.GetAt(m_nCount-1) ;
- if ( cCount<0 || cCount > 255 ) //!不是ASCII码字符
- m_nCount-- ;
- m_nCount-- ;
- if( m_nCount < 0 )
- m_nCount = 0 ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount) ;
- }
- else
- {
- char cCount = m_strInput.GetAt(m_nCount) ;
- if ( cCount< 0 || cCount > 255 ) //!不是ASCII码字符
- {
- if ( m_nCount < m_nInputMaxLen - 1 )
- m_nCount += 2 ;
-
- }
- else
- {
- if ( m_nCount < m_nInputMaxLen )
- m_nCount++ ;
- }
- if( m_nCount > m_strInput.GetLength( ) )
- m_nCount = m_strInput.GetLength( ) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount ) ;
- }
- }
- else //字符和数字键
- {
- if ( m_nMode == Number_Mode ) //数字输入模式
- {
- if ( nChar >= 48 && nChar <= 57 )
- {
- // m_strInput = m_strInput + cChar ;
- //this->UpdateData(FALSE) ;
- }
-
- return TRUE ;
- }
- else if (m_nMode == Char_Mode) //字符输入模式
- {
- if( ( nChar >= 65 && nChar <= 90) || ( nChar >= 48 && nChar <= 57 ) )
- {
- // m_strInput = m_strInput + cChar ;
- // this->UpdateData(FALSE) ;
-
- }
-
- return TRUE ;
- }
- else if ( m_nMode == Spell_Mode ) // 拼音输入方式
- {
- if( nChar >= 65 && nChar <= 90)
- {
- m_strChar =m_strChar + cChar ;
- m_Inputer.Put(_T(cChar));
-
- }
- else
- return TRUE ;
- }
- else if (m_nMode == StrokesOrder_Mode) //笔顺输入模式
- {
- if (nChar >= 49 && nChar <= 53 )
- {
- m_strChar =m_strChar + strStrokeOrder.Mid(2* (nChar-49),2) ;
- m_strOrderFilter = m_strOrderFilter + cChar ;
-
- m_Inputer.Put( cChar ) ;
- }
- else
- return TRUE ;
-
- }
- }
-
- this->UpdateData(FALSE ) ;
- if (m_nMode == Spell_Mode ) //拼音输放模式
- {
- strFilter = m_Inputer.GetSpell( ) ;
- if ( strFilter.GetLength( ) < 1 ) //没有字符串
- return TRUE ; //CDialog::PreTranslateMessage(pMsg);
- strFilter.MakeLower( ) ;
- ChineseDictionary::SpellQuery * spellquery = m_ChineseInputer.GetSpellQuery( ) ;
- enumer.clear( );
- if ( !spellquery->QueryWords(strFilter , enumer ) )
- return TRUE ;
-
- //增中排序
- }
- else if ( m_nMode == StrokesOrder_Mode) //笔顺
- {
- strFilter = m_Inputer.GetStrokesOrder( ) ;
- if ( strFilter.GetLength( ) < 1 ) //没有字符串
- return TRUE ; //CDialog::PreTranslateMessage(pMsg);
-
- ChineseDictionary::StrokesOrderQuery * STrokeOrderQuery = m_ChineseInputer.GetStrokesOrderQuery( ) ;
- enumer.clear( );
- if ( !STrokeOrderQuery->QueryWords(strFilter , enumer ))
- return TRUE ;
- //增中排序
- }
- CString stri ;
- m_lsList.ResetContent( ) ;
- ChineseInputer::WordEnumerator::iterator it ;
-
- m_it= enumer.begin( ) ;
- m_nPageCount = (int)(enumer.size( )/m_nPageSize) ; //总页数
- //计数总页数
- if ( (enumer.size( ) % m_nPageSize ) != 0 )
- m_nPageCount = m_nPageCount + 1 ;
- m_nCurrPage = 0 ; //当前页码
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
- if ( m_it == enumer.end( ) )
- break ;
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
- if ( i != m_nPageSize )
- m_it++ ; //下移一个
- }
- }
- else
- return TRUE ;
- }
- }
- }
- /*! @function public SpellQuery
********************************************************************************
brief
功能 : 根据输入的拼音字母查询汉字 <br>
函数名 :
return BOOL <insert return value description here>
exception
author zqp
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
BOOL CDlgInput::SpellQuery( )
- {
-
- CString strFilter = m_Inputer.GetSpell( ) ;
- if ( strFilter.GetLength( ) < 1 ) //没有字符串
- return TRUE ; //CDialog::PreTranslateMessage(pMsg);
- strFilter.MakeLower( ) ;
- ChineseDictionary::SpellQuery * spellquery = m_ChineseInputer.GetSpellQuery( ) ;
- enumer.clear( );
- if ( !spellquery->QueryWords(strFilter , enumer ) ) //!查询失败
- return FALSE ;
- CString stri ;
- m_lsList.ResetContent( ) ;
- ChineseInputer::WordEnumerator::iterator it ;
-
- m_it= enumer.begin( ) ;
- m_nPageCount = (int)(enumer.size( )/m_nPageSize) ; //!总页数
- //!计数总页数
- if ( (enumer.size( ) % m_nPageSize ) != 0 )
- m_nPageCount = m_nPageCount + 1 ;
- m_nCurrPage = 0 ; //!当前页码
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
- if ( m_it == enumer.end( ) )
- break ;
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
- if ( i != m_nPageSize )
- m_it++ ; //下移一个
- }
- }
- void CDlgInput::OnBnClickedBtnabc( )
- {
- // TODO: 在此添加控件通知处理程序代码
- //MSG * pMsg ;
- // pMsg->hwnd = this->m_hWnd ;
- // pMsg->wParam = 65 ;
- this->PostMessage(WM_KEYUP ,65,0 ) ;
- }
- void CDlgInput::OnLbnDblclkList( )
- {
- // TODO: 在此添加控件通知处理程序代码
-
-
- }
- //void CDlgInput::OnLbnSelchangeList( )
- //{
- // // TODO: 在此添加控件通知处理程序代码
- //}
- BOOL CDlgInput::OnInitDialog( )
- {
- CDialog::OnInitDialog();
- //HICON ico = ::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICOHOME) ) ; //IDI_QUESTION MAKEINTRESOURCE( IDI_ICOHOME) ) ;
- //m_btnB1.SetIcon(ico ) ;
- //!初始化上翻,下翻,最前和最后的按钮图标
- m_btnHome.SetIcon(::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICOHOME) ) ) ;
- m_btnEnd.SetIcon(::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICOEND) ) ) ;
- m_btnUpPage.SetIcon(::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICOUPPAGE) ) ) ;
- m_btnDownPage.SetIcon(::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICODOWNPAGE) ) ) ;
-
- //!初始化回退按钮的图标
- m_btnBack.SetIcon(::LoadIcon( ::AfxGetInstanceHandle( ),MAKEINTRESOURCE(IDI_ICOBACK) ) ) ;
- CFont ft ;
- ft.CreateFont(19, // nHeight
- 10, // nWidth
- 0, // nEscapement
- 0, // nOrientation
- 15, // nWeight FW_NORMAL
- FALSE, // bItalic
- FALSE, // bUnderline
- 0, // cStrikeOut
- DEFAULT_CHARSET, // nCharSet
- OUT_DEFAULT_PRECIS, // nOutPrecision
- CLIP_DEFAULT_PRECIS, // nClipPrecision
- DEFAULT_QUALITY, // nQuality
- DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
- "宋体" ); // lpszFacename Arial
- //!设置列表框的字体
- m_lsList.SetFont( &ft ) ;
- ft.DeleteObject( ) ;
- //!初始化光标前的字符个数为0;
- m_nCount = 0 ;
- m_nPageCount = 0 ;
- enumer.clear( ) ;
-
- //!初始化输入框的字体
- LOGFONT lf ;
- lf.lfHeight = 20 ;
- lf.lfWidth = 10 ;
- lf.lfEscapement = 0 ;
- lf.lfOrientation= 0 ;
- lf.lfWeight = 15 ;
- lf.lfItalic =FALSE ;
- lf.lfUnderline = FALSE ;
- lf.lfStrikeOut = 0 ;
- lf.lfCharSet = DEFAULT_CHARSET ;
- lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
- lf.lfQuality = DEFAULT_QUALITY ;
- lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS ;
- //lf.lfFaceName =CString::CopyChars( "宋体" ;
- //StringCchCopy( (LPSTR)&lf.lfFaceName, 5, "宋体" );
- TCHAR * strFace = "宋体" ;
- ::strcpy(lf.lfFaceName ,strFace ) ;
-
- CFont fInput ; //! 获取输入框的字
- fInput.CreateFontIndirect( &lf ) ;
- m_edtIn.SetFont(&fInput) ;
-
-
- //fInput->GetLogFont( &lf) ;
- //CString fName = lf.lfFaceName ;
-
- //!默认的输入模式为拼音输入法
- m_nMode = Spell_Mode ;
-
- //!默认为小写
- m_nUpperOrLower = CharLower ;
-
- //!初始化连续击键的时间间隔 ,单位是毫秒
- m_nTimeGap = 1000 ;
- //!初始化前一次击键的时间
- m_tPreTime = CFileTime::GetCurrentTime( ) ;
-
- //!初始化前一次击键的序号
- m_nPreBtnNo = 0 ;
- m_edtIn.SetLimitText(m_nInputMaxLen ) ;
-
- //!初始化特殊符号
- m_aSymbol[0] ='!' ;
- m_aSymbol[1] ='@' ;
- m_aSymbol[2] ='#' ;
- m_aSymbol[3] ='$' ;
- m_aSymbol[4] ='%' ;
- m_aSymbol[5] ='?' ;
- m_aSymbol[6] ='&' ;
- m_aSymbol[7] ='*' ;
- m_aSymbol[8] ='(' ;
- m_aSymbol[9] =')' ;
- m_aSymbol[10] ='-' ;
- m_aSymbol[11] ='+' ;
- m_aSymbol[12] ='=' ;
- m_aSymbol[13] ='_' ;
- m_aSymbol[14] ='.' ;
- m_aSymbol[15] ='^' ;
- m_aSymbol[16] ='<' ;
- m_aSymbol[17] ='>' ;
- // TODO: 在此添加额外的初始化
- //开启一个线程
- //if ( m_pWinThread == NULL )
- //{
- m_ThreadInfor.hWnd = this->m_hWnd ;
- m_ThreadInfor.lpKillThread = &m_bKillThread ;
- m_ThreadInfor.lpLock = &m_bLock ;
- m_ThreadInfor.pBtnMsg = &m_BtnMsg ;
-
- m_pWinThread = AfxBeginThread(ThreadProc ,(LPVOID)&m_ThreadInfor) ;
- m_pWinThread->m_bAutoDelete = FALSE ;
- //}
- return TRUE; // return TRUE unless you set the focus to a control
- // 异常: OCX 属性页应返回 FALSE
- }
- void CDlgInput::BtnClick(int nBtnNo )
- {
-
- //等待开锁
- while(m_bLock == TRUE )
- {
- }
- // 加锁
- m_bLock = TRUE ;
- CBtnMsg * pBtn = new CBtnMsg( ) ;
- // pBtn->cCurrTime = CTime::GetCurrentTime( ) ;
- int* pNo = new int(nBtnNo);
- pBtn->pBtnNo = pNo ;
- CFileTime * ft1= new CFileTime(CFileTime::GetCurrentTime( ) ) ;
- pBtn->pCurrTime = ft1 ;
- m_BtnMsg.AddTail( pBtn) ;
- //解锁
- m_bLock = FALSE ;
- }
- void CDlgInput::BtnClickEx(int nBtnNo ,int nNumber )
- {
- if ( m_nMode == StrokesOrder_Mode ) //笔顺
- {
- ::PostMessage(m_hWnd , WM_KEYUP,nNumber ,0) ;
- }
- else if ( m_nMode == Number_Mode ) //数字
- {
- InputNumber( nBtnNo ) ;
- }
- else if ( m_nMode == Spell_Mode ) //拼音
- {
- //不使用线程的方式
- // BtnClick(nBtnNo) ;
-
- InputSpell(nBtnNo ) ;
- }
- else if ( m_nMode ==Char_Mode ) //字符
- {
- InputChar( nBtnNo ) ;
- }
- }
- void CDlgInput::OnBnClickedBtn1( )
- {
-
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(1,49) ;
- }
- void CDlgInput::OnBnClickedBtn2( )
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(2,50) ;
- }
- void CDlgInput::OnBnClickedBtn3( )
- {
- BtnClickEx(3,51) ;
- // TODO: 在此添加控件通知处理程序代码
- }
- void CDlgInput::OnBnClickedBtn4()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(4,52) ;
- }
- void CDlgInput::OnBnClickedBtn5()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(5,53) ;;
- }
- void CDlgInput::OnBnClickedBtn6()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(6,54) ;
- }
- void CDlgInput::OnBnClickedBtn7()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(7,55) ;
- }
- void CDlgInput::OnBnClickedBtn8()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(8,56) ;
- }
- void CDlgInput::OnBnClickedBtn9()
- {
- // TODO: 在此添加控件通知处理程序代码
- BtnClickEx(9,57) ;
- }
- void CDlgInput::OnBnClickedBtnhome( ) //第一页
- {
- // TODO: 在此添加控件通知处理程序代码
- CString stri ;
-
- if(m_nMode == Char_Mode || m_nMode == Number_Mode) //!字符输入模式或数字输入模式
- {
- SymbolHome( ) ;
- return ;
- }
- if ( ( m_nCurrPage != 0 ) && (m_nPageCount > 0 ) ) //不是第一页
- {
- m_nCurrPage = 0 ; //置为第一页
- int i = 1 ;
- m_lsList.ResetContent( ) ;
-
- for (m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++ )
- {
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
- if ( i == m_nPageSize )
- break ;
- else
- i++ ;
- }
-
- }
- else
- {
- //::Beep(500,1000 ) ;
- }
- }
- void CDlgInput::OnBnClickedBtndowngage( ) //下翻一页
- {
- // TODO: 在此添加控件通知处理程序代码
- CString stri ;
- if(m_nMode == Char_Mode || m_nMode == Number_Mode) //!字符输入模式或数字
- {
- SymbolDownPage( ) ;
- return ;
- }
- if ( ( m_nCurrPage != (m_nPageCount-1)) && (m_nPageCount > 0 ) ) //不是最后一页
- {
- m_nCurrPage = m_nCurrPage + 1 ;
- m_lsList.ResetContent( ) ; //清空原来的
- for (int i = 1 ; i<= 10 ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
- m_it++ ; //下移一个
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
- if ( m_it == enumer.end( ) )
- break ;
- }
- }
- else
- {
- //::Beep(500,1000 ) ;
- }
- }
- void CDlgInput::OnBnClickedBtnend() //最后一页
- {
- // TODO: 在此添加控件通知处理程序代码
- CString stri ;
-
- if(m_nMode == Char_Mode || m_nMode == Number_Mode) //!字符输入模式或数字
- {
- SymbolEnd( ) ;
- return ;
- }
- if ( ( m_nCurrPage != (m_nPageCount-1) ) && (m_nPageCount > 0 ) ) //不是最后一页
- {
-
- m_nCurrPage = (m_nPageCount-1) ;//当前页置为最后一页
- m_it = enumer.begin( ) ;
- for (int j = 1 ; j < (m_nPageCount-1)* m_nPageSize ; j++ )
- {
- m_it++ ;
- }
- m_lsList.ResetContent( ) ; //清空原来的
- int i = 0 ;
- while (m_it !=enumer.end() ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
- i++ ;
- m_it++ ; //下移一个
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
-
- }
-
- }
- else
- {
- //::Beep(500,1000 ) ;
- }
- }
- void CDlgInput::OnBnClickedBtnupgage( ) //向上一页
- {
- // TODO: 在此添加控件通知处理程序代码
- CString stri ;
- if(m_nMode == Char_Mode || m_nMode == Number_Mode ) //!字符输入模式 或数字
- {
- SymbolUpPage( ) ;
- return ;
- }
- if ( (m_nCurrPage != 0) && ( m_nPageCount > 0 ) ) //不是第一页
- {
-
- int nUpCount ; //回退的项数
- if ( m_nCurrPage == (m_nPageCount-1) ) //是最后一页
- {
- m_it = enumer.begin( ) ;
- for (int j = 1 ; j < (m_nPageCount-2)* m_nPageSize ; j++ )
- {
- m_it++ ;
- }
- }
- else if ( m_nCurrPage ==1 ) //是第二页
- {
- OnBnClickedBtnhome( ) ; //置为第一页
- return ;
- }
- else //既不是最后一页,也不是第二页
- {
- nUpCount = 2*m_nPageSize ;
- //向上回退nUpCount项
- for (int j =1 ; j <= nUpCount ; j++ )
- {
- m_it-- ;
- if ( m_it == enumer.begin( ) )
- break ;
- }
- }
- m_nCurrPage = m_nCurrPage - 1 ;
- m_lsList.ResetContent( ) ; //清空原来的
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
-
- m_it++ ; //下移一个
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- m_lsList.AddString( stri+ ":" + (CString)(Word)(*m_it)) ;
- }
- }
- else
- {
- // ::Beep(500,1000 ) ;
- }
- }
-
-
/*! @function public RadioFunc
********************************************************************************
brief
功能 : 一组Radio 按钮的处理功能 <br>
函数名 :
@param nInputMode int 输入模式
return void 无返回值
exception
author zqp
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
void CDlgInput::RadioFunc( int nInputMode )
- {
- switch ( nInputMode )
- {
- case Spell_Mode : //!拼音模式
- {
- m_nMode =Spell_Mode ;
- m_bSpell = FALSE ;
- m_bNum = TRUE ;
- m_bChar = TRUE ;
- m_bStrokeOrder = TRUE ;
- break;
- }
- case BS_Mode : //!部首模式
- {
- break ;
- }
- case Strokes_Mode : //!笔画模式
- {
- break;
- }
- case StrokesOrder_Mode ://!笔顺模式
- {
- m_nMode =StrokesOrder_Mode ;
- m_bSpell = TRUE ;
- m_bNum = TRUE ;
- m_bChar = TRUE ;
- m_bStrokeOrder = FALSE ;
- break;
- }
- case Number_Mode : //!数字模式
- {
- m_nMode =Number_Mode ;
- m_bSpell = TRUE ;
- m_bNum = FALSE ;
- m_bChar = TRUE ;
- m_bStrokeOrder = TRUE ;
- break ;
- }
- case Char_Mode ://!字符模式
- {
- m_nMode =Char_Mode ;
- m_bSpell = TRUE ;
- m_bNum = TRUE ;
- m_bChar = FALSE ;
- m_bStrokeOrder = TRUE ;
-
- }
- } //!Switch end
-
- if (m_nMode >= Spell_Mode && m_nMode <= StrokesOrder_Mode )
- {
- m_Inputer.SetMode(m_nMode) ;
- m_Inputer.Reset( ) ;
- }
- m_strChar ="" ;
- m_strOrderFilter = "" ;
- enumer.clear( ) ;
- m_lsList.ResetContent( ) ;
- m_nPageCount = 0 ;
- this->UpdateData(FALSE ) ;
- }
- void CDlgInput::OnBnClickedRadspell()
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode !=Spell_Mode )
- RadioFunc( Spell_Mode ) ;
-
- }
- void CDlgInput::OnBnClickedRadnum()
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode !=Number_Mode )
- RadioFunc(Number_Mode ) ;
-
- }
- void CDlgInput::OnBnClickedRadchar()
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode !=Char_Mode )
- RadioFunc(Char_Mode ) ;
-
- }
- void CDlgInput::OnBnClickedRadstrokeorder()
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode !=StrokesOrder_Mode )
- RadioFunc(StrokesOrder_Mode ) ;
-
- }
- void CDlgInput::OnBnClickedBtn10( )
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode == Number_Mode )
- InputNumber( 10 ) ;
- }
- void CDlgInput::OnBnClickedBtnback( )
- {
- // TODO: 在此添加控件通知处理程序代码
- // ::PostMessage(m_hWnd , WM_KEYDOWN,8 ,0) ;
- // ::PostMessage(m_hWnd , WM_CHAR,8 ,0) ;
- if ( m_strChar.GetLength( ) > 0 )
- {
- ::PostMessage(m_hWnd , WM_KEYUP,8 ,0) ;
- }
- else
- {
- DeleteChar( ) ;
- }
-
- }
- void CDlgInput::OnBnClickedBtnleft()
- {
- // TODO: 在此添加控件通知处理程序代码
- ::PostMessage(m_hWnd , WM_KEYUP,37 ,0) ;
-
- }
- void CDlgInput::OnBnClickedBtnright()
- {
- // TODO: 在此添加控件通知处理程序代码
- ::PostMessage(m_hWnd , WM_KEYUP,39 ,0) ;
- }
- void CDlgInput::OnEnSetfocusEdtin( )
- {
-
- // TODO: 在此添加控件通知处理程序代码
- /*
- m_edtIn.CreateSolidCaret(1, 25);
- //CPoint pos =m_edtIn.GetCaretPos( ) ;
- //m_edtIn.SetCaretPos(m_pLocal ) ;
- m_edtIn.ShowCaret( );
- */
-
- }
- void CDlgInput::OnEnKillfocusEdtin( )
- {
- // TODO: 在此添加控件通知处理程序代码
- //m_pLocal =m_edtIn.GetCaretPos( ) ;
- //CString strdis ;
- // strdis.Format("x=%d ,y=%d" ,m_pLocal.x ,m_pLocal.y ) ;
- // ::AfxMessageBox( strdis) ;
- //m_edtIn.HideCaret( ) ;
- }
- void CDlgInput::InputChar( int nBtnNO ) //输入字符串
- {
- TCHAR aUpperChar[9][4] ={{'A','B','C'},{'D','E','F'},{'G','H','I'},
- {'J','K','L'},{'M','N','O'},{'P','Q','R'},
- {'S','T','U'},{'V','W','X'},{'Y','Z',' '} };
- TCHAR aLowerChar[9][4] ={{'a','b','c'},{'d','e','f'},{'g','h','i'},
- {'j','k','l'},{'m','n','o'},{'p','q','r'},
- {'s','t','u'},{'v','w','x'},{'y','z',' '} };
-
- TCHAR cChar ;
- CFileTimeSpan tSpan ;
- CFileTime tCurrTime =CFileTime::GetCurrentTime( ) ;
- tSpan = tCurrTime - m_tPreTime ; //!前一次击键的时间间隔
- BOOL bIsAdd = TRUE ; //! 是否是增加
-
-
- if ( m_nPreBtnNo != nBtnNO ) //使用不同的字符
- {
- if ( m_nUpperOrLower == CharUpper )
- cChar = aUpperChar[nBtnNO-1][0] ;
- else
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else if ( ( m_nPreBtnNo == nBtnNO ) && ( tSpan >= m_nTimeGap*CFileTime::Millisecond ) )
- {
- if ( m_nUpperOrLower == CharUpper )
- cChar = aUpperChar[nBtnNO-1][0] ;
- else
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else if ( ( m_nPreBtnNo == nBtnNO ) && ( tSpan < m_nTimeGap*CFileTime::Millisecond ) ) //!击键间隔在1秒之内
- {
-
- CString strPos = m_strInput.Mid(m_nCount-1,1) ;
- if ( m_nUpperOrLower == CharUpper )
- {
- for (int i = 0 ; i < 3 ; i++ )
- {
- if (aUpperChar[nBtnNO-1][i] == strPos )
- break ;
- }
-
- if ( ( i== 3 ) || ( i ==2 ) )
- {
- cChar = aUpperChar[nBtnNO-1][0] ;
- }
- else
- {
- cChar = aUpperChar[nBtnNO-1][ i+1] ;
- }
- }
- else
- {
- for (int i = 0 ; i < 3 ; i++ )
- {
- if (aLowerChar[nBtnNO-1][i] == strPos )
- break ;
- }
-
- if ( ( i== 3 ) || ( i ==2 ) )
- {
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else
- {
- cChar = aLowerChar[nBtnNO-1][ i+1] ;
- }
- }
- bIsAdd = FALSE ; //!置修改标志
- }
-
- m_nPreBtnNo = nBtnNO ; //置为前一次按键序号
- m_tPreTime = tCurrTime ; //置为前一次按键时间
- CString strRight ;
- if (m_strInput.GetLength( ) == m_nCount ) //当前的光标在最后
- {
- if ( bIsAdd == TRUE ) //!增加
- {
-
- if ( IsExceedLimit(1) ) //超出了限制
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- return ;
- }
- m_strInput = m_strInput + cChar ;
- m_nCount++ ;
- }
- else //!修改
- {
- m_strInput = m_strInput.Left( m_strInput.GetLength( ) -1 ) + cChar ;
- }
- }
- else //!当前光标不在最后
- {
- if ( bIsAdd == TRUE ) //!增加
- {
- if ( IsExceedLimit(1) ) //超出了限制
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- return ;
- }
- strRight = m_strInput.Right(m_strInput.GetLength( ) - m_nCount ) ;
- m_strInput = m_strInput.Left( m_nCount ) ;
- m_strInput = m_strInput + cChar + strRight ;
- m_nCount++ ;
- }
- else //!修改
- {
- strRight = m_strInput.Right(m_strInput.GetLength( ) - m_nCount ) ;
- m_strInput = m_strInput.Left( m_nCount -1 ) ;
- m_strInput = m_strInput + cChar + strRight ;
- }
- }
- this->UpdateData(FALSE) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount-1,m_nCount ) ;
- }
- /*! @function public InputSpell
********************************************************************************
brief
功能 : 输入拼音字母 <br>
函数名 :
return void
exception
author zqp
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
void CDlgInput::InputSpell( int nBtnNO )
- {
- TCHAR aLowerChar[9][4] ={{'a','b','c'},{'d','e','f'},{'g','h','i'},
- {'j','k','l'},{'m','n','o'},{'p','q','r'},
- {'s','t','u'},{'v','w','x'},{'y','z',' '} };
-
- TCHAR cChar ;
- CFileTimeSpan tSpan ;
- CFileTime tCurrTime =CFileTime::GetCurrentTime( ) ;
- tSpan = tCurrTime - m_tPreTime ; //!前一次击键的时间间隔
- BOOL bIsAdd = TRUE ; //! 是否是增加
-
-
- if ( m_nPreBtnNo != nBtnNO ) //使用不同的字符
- {
-
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else if ( ( m_nPreBtnNo == nBtnNO ) && ( tSpan >= m_nTimeGap*CFileTime::Millisecond ) )
- {
-
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else if ( ( m_nPreBtnNo == nBtnNO ) && ( tSpan < m_nTimeGap*CFileTime::Millisecond ) ) //!击键间隔在1秒之内
- {
-
- CString strPos = m_strChar.Mid(m_strChar.GetLength( )-1 ,1) ;
-
- for (int i = 0 ; i < 3 ; i++ )
- {
- if (aLowerChar[nBtnNO-1][i] == strPos )
- break ;
- }
-
- if ( ( i== 3 ) || ( i ==2 ) )
- {
- cChar = aLowerChar[nBtnNO-1][0] ;
- }
- else
- {
- cChar = aLowerChar[nBtnNO-1][ i+1] ;
- }
- bIsAdd = FALSE ; //!置修改标志
- }
-
- m_nPreBtnNo = nBtnNO ; //置为前一次按键序号
- m_tPreTime = tCurrTime ; //置为前一次按键时间
-
- if ( bIsAdd == TRUE ) //!增加
- {
- if (m_strChar.GetLength( ) >= m_nCharMaxLen )
- return ;
- m_strChar = m_strChar + cChar ;
-
- }
- else //!修改
- {
- m_strChar = m_strChar.Left( m_strChar.GetLength( ) -1 ) + cChar ;
- }
- this->UpdateData(FALSE) ;
- m_Inputer.Reset( ) ;
- m_Inputer.Put(_T(m_strChar) ) ;
- SpellQuery( ) ;
-
- }
- /*! @function public DeleteChar
********************************************************************************
brief
功能 :删除一个字符 <br>
函数名 :
return void 无返回值
exception
author zqp
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
void CDlgInput::DeleteChar( )
- {
-
-
- if ( m_nCount > 0 )
- {
- char cCount = m_strInput.GetAt(m_nCount-1) ;
- if ( cCount<0 || cCount > 255 ) //!不是ASCII码字符
- {
- m_nCount-=2 ;
- m_strInput.Delete(m_nCount,2 ) ;
- }
- else
- {
- m_nCount-- ;
- m_strInput.Delete(m_nCount,1 ) ;
- }
-
- this->UpdateData(FALSE) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount ) ;
- }
- }
- /*! @function public InputNumber
********************************************************************************
brief
功能 : <br>
函数名 :
@param nBtnNO int < insert parameter description here>
return void <insert return value description here>
exception
author
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
void CDlgInput::InputNumber( int nBtnNO ) //输入数字
- {
- TCHAR aChar[10] = {'1','2','3','4','5','6','7','8','9','0'} ;
- TCHAR cChar = aChar[nBtnNO-1] ;
-
- if ( IsExceedLimit(1) ) //超出了限制
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- return ;
- }
-
- CString strRight ;
- if (m_strInput.GetLength( ) == m_nCount ) //当前的光标在最后
- {
- m_strInput = m_strInput + cChar ;
- }
- else //!当前光标不在最后
- {
- strRight = m_strInput.Right(m_strInput.GetLength( ) - m_nCount ) ;
- m_strInput = m_strInput.Left( m_nCount ) ;
- m_strInput = m_strInput + cChar + strRight ;
-
- }
- m_nCount++ ;
- this->UpdateData(FALSE) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount-1,m_nCount );
- }
- /*! @function public InputSymbol
********************************************************************************
brief
功能 : 输入一些特殊的符号 <br>
函数名 :
return void 无返回值
exception
author zqp
remark <br>
典型用法:输入:'#','$' <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
void CDlgInput::InputSymbol( )
- {
-
- CString strword ;
- if ( IsExceedLimit(1) ) //超出了限制
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- return ;
- }
- int nIndex =m_lsList.GetCurSel( ) ;
- nIndex = m_nCurrPage*m_nPageSize + nIndex ;
- if ( ( nIndex > m_nSymbolCount ) || ( m_nPageCount < 1 ) )
- return ;
- strword = m_aSymbol[nIndex] ;
- if (m_strInput.GetLength( ) == m_nCount ) //当前的光标在最后
- {
- m_strInput = m_strInput + strword ;
- }
- else //!当前光标不在最后
- {
- CString strRight = m_strInput.Right(m_strInput.GetLength( ) - m_nCount ) ;
- m_strInput = m_strInput.Left( m_nCount ) ;
- m_strInput = m_strInput + strword + strRight ;
-
- }
- m_nCount++ ;
- this->UpdateData(FALSE) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- }
-
- //最接近的除法
-
- /*! @function public NearDev
********************************************************************************
brief
功能 : <br>
函数名 :
@param DevNum int 除数
@param DevedNum int 被除数
return int 除法的结果
exception
author 邹清平
remark <br>
典型用法: 9/5 = 2 ; 6/5 =1 <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
int CDlgInput::NearDev(int DevNum ,int DevedNum )
- {
- int nRec ,nMode ;
- nRec = (int) DevedNum/DevNum ;
- nMode = DevedNum % DevNum ;
-
- if ( nMode > (int)DevNum/2 )
- nRec++ ;
- return nRec ;
- }
- void CDlgInput::OnLbnSelchangeList( )
- {
- // TODO: 在此添加控件通知处理程序代码
- ChineseInputer::WordEnumerator::iterator it ;
- int nIndex ;
- if ( m_nMode == Char_Mode || m_nMode == Number_Mode ) //是字符输入模式
- {
- InputSymbol( ) ;
- return ;
- }
-
- if ( IsExceedLimit(2) ) //超出了限制
- {
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
- return ;
- }
-
- nIndex = m_lsList.GetCurSel( ) ;
- nIndex = m_nCurrPage * m_nPageSize + nIndex ;
- //
- int i = 0 ;
- for( it = enumer.begin( ) ; it !=enumer.end() ;it++ )
- {
- if ( i == nIndex )
- break ;
- else
- i++ ;
- }
- CString strword ="" ;
- strword = (CString)(Word)(*it) ;
- strword.TrimLeft( ) ;
- strword = strword.Left(2);
-
- if (m_strInput.GetLength( ) == m_nCount ) //当前的光标在最后
- {
- m_strInput = m_strInput + strword ;
- }
- else //!当前光标不在最后
- {
- CString strRight = m_strInput.Right(m_strInput.GetLength( ) - m_nCount ) ;
- m_strInput = m_strInput.Left( m_nCount ) ;
- m_strInput = m_strInput + strword + strRight ;
-
- }
- m_nCount++ ;
- m_nCount++ ;
- m_strChar = "" ;
- m_strOrderFilter ="" ;
- m_Inputer.Reset( ) ;
- this->UpdateData(FALSE) ;
- m_edtIn.SetFocus( ) ;
- m_edtIn.SetSel(m_nCount,m_nCount );
-
-
- }
- void CDlgInput::OnEnMaxtextEdtin()
- {
- // TODO: 在此添加控件通知处理程序代码
- ::AfxMessageBox("超出了最大的长度" ) ;
- }
- /*! @function public IsExceedLimit
********************************************************************************
brief
功能 : 判断是否超出输入框的最在长度 <br>
函数名 :
@param nInputLen int 需要输入的长度
return BOOL TRUE 表示超出,FALSE 表示没有超出
exception
author 邹清平
remark <br>
典型用法: <br>
复杂度 :
*******************************************************************************/
/////// comment generated by CommentMakerPro from www.FeinSoftware.com ////////
BOOL CDlgInput::IsExceedLimit( int nInputLen )
- {
- if ( m_strInput.GetLength( ) + nInputLen > m_nInputMaxLen )
- return TRUE ;
- else
- return FALSE ;
- }
- void CDlgInput::MakeSymbol( ) //生成特殊符号
- {
-
- CString stri ;
-
- m_nPageCount = (int)( m_nSymbolCount/m_nPageSize) ; //总页数
- //计数总页数
- if ( (m_nSymbolCount % m_nPageSize ) != 0 )
- m_nPageCount = m_nPageCount + 1 ;
- m_nCurrPage = 0 ; //当前页码
- int nIndex ;
- m_lsList.ResetContent( ) ;
- for (int i =1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
-
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- nIndex = m_nCurrPage*m_nPageSize + i - 1 ;
- if ( nIndex >= m_nSymbolCount )
- break ;
- m_lsList.AddString( stri+ ":" + m_aSymbol[ nIndex] ) ;
- }
- }
- void CDlgInput::SymbolHome( ) //首页
- {
- CString stri ;
- if( m_nCurrPage == 0 || m_nPageCount == 0 ) //第一页
- return ;
- m_nCurrPage = 0 ; //当前页码
- int nIndex ;
- m_lsList.ResetContent( ) ;
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
-
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- nIndex = m_nCurrPage*m_nPageSize + i-1 ;
- if ( nIndex >= m_nSymbolCount )
- break ;
- m_lsList.AddString( stri+ ":" + m_aSymbol[ nIndex] ) ;
- }
- }
- void CDlgInput::SymbolEnd( ) //末页
- {
- CString stri ;
- if( m_nCurrPage == m_nPageCount-1 || m_nPageCount == 0 ) //最后一页
- return ;
- m_nCurrPage = m_nPageCount-1 ; //当前页码
- int nIndex ;
- m_lsList.ResetContent( ) ;
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
-
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- nIndex = m_nCurrPage*m_nPageSize + i - 1 ;
- if ( nIndex >= m_nSymbolCount )
- break ;
- m_lsList.AddString( stri+ ":" + m_aSymbol[ nIndex] ) ;
- }
- }
- void CDlgInput::SymbolUpPage( ) //上一页
- {
- CString stri ;
- if( m_nCurrPage == 0 || m_nPageCount == 0 ) //第一页
- return ;
- m_nCurrPage-- ; //当前页码
- if ( m_nCurrPage < 0 )
- m_nCurrPage = 0 ;
- int nIndex ;
- m_lsList.ResetContent( ) ;
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
-
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- nIndex = m_nCurrPage*m_nPageSize + i - 1 ;
- if ( nIndex >= m_nSymbolCount )
- break ;
- m_lsList.AddString( stri+ ":" + m_aSymbol[ nIndex] ) ;
- }
- }
- void CDlgInput::SymbolDownPage( ) // 下一页
- {
- CString stri ;
-
- if( m_nCurrPage == m_nPageCount-1 || m_nPageCount == 0 ) //最后一页
- return ;
- m_nCurrPage++ ; //当前页码
- if ( m_nCurrPage > m_nPageCount-1 )
- m_nCurrPage = m_nPageCount-1 ;
- int nIndex ;
- m_lsList.ResetContent( ) ;
- for (int i = 1 ; i<= m_nPageSize ; i++ ) //m_it =enumer.begin( ) ; m_it !=enumer.end() ;m_it++
- {
- if ( i == 10 )
- stri.Format("%d" ,0) ;
- else
- stri.Format("%d" ,i) ;
- nIndex = m_nCurrPage*m_nPageSize + i-1 ;
- if ( nIndex >= m_nSymbolCount )
- break ;
- m_lsList.AddString( stri+ ":" + m_aSymbol[ nIndex] ) ;
- }
- }
- void CDlgInput::OnBnClickedBtn11( )
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nMode == Char_Mode || m_nMode == Number_Mode ) //字符输入模式
- MakeSymbol( ) ;
- }
- void CDlgInput::OnBnClickedRadupper( )
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nUpperOrLower == CharUpper )
- return ;
- m_bUpper = FALSE ;
- m_bLower =TRUE ;
- m_nUpperOrLower = CharUpper ;
- this->UpdateData(FALSE ) ;
- }
- void CDlgInput::OnBnClickedRadlower( )
- {
- // TODO: 在此添加控件通知处理程序代码
- if ( m_nUpperOrLower == CharLower )
- return ;
- m_bUpper = TRUE ;
- m_bLower =FALSE ;
- m_nUpperOrLower = CharLower ;
- this->UpdateData(FALSE ) ;
- }
- void CDlgInput::OnBnClickedBtnok( )
- {
- // TODO: 在此添加控件通知处理程序代码
- OnOK( ) ;
- }