void CClientSocketDlg::OnBtnDisconnect() { // Disconnect socket m_SocketManager.StopComm(); if (!m_SocketManager.IsOpen()) { GetDlgItem(IDC_BTN_START)->EnableWindow( TRUE ); PrevDlgCtrl(); GetDlgItem(IDC_BTN_SEND)->EnableWindow( FALSE ); GetDlgItem(IDC_BTN_STOP)->EnableWindow( FALSE ); GetDlgItem(IDC_TCP)->EnableWindow( TRUE ); GetDlgItem(IDC_UDP)->EnableWindow( TRUE ); } }
void CPrintSize::OnSetfocusSecret2() { BOOL bForward = (m_active_item_id == 0); if (ChangeFocus(0)) { if (bForward) { NextDlgCtrl(); } else { PrevDlgCtrl(); } } }
void CSearchReplaceDlg::OnReplaceButton() { CMenu menu; CMenu *pmenuPopup; DWORD dwSelectionMade; CString replaceText; if (!UpdateData(TRUE)) return; // Show menu VERIFY( menu.LoadMenu(IDR_REPLACE) ); pmenuPopup = menu.GetSubMenu(0); ASSERT(pmenuPopup != NULL); if (!m_bUse || m_nUse != CSearchReplaceFilter::useRegExp) pmenuPopup->EnableMenuItem(8, MF_BYPOSITION | MF_GRAYED); if (!m_bUse || m_nUse != CSearchReplaceFilter::useWildcards) pmenuPopup->EnableMenuItem(9, MF_BYPOSITION | MF_GRAYED); dwSelectionMade = m_ctlReplaceButton.DoSingleClick(menu); PushUpdatesFreeze(); // Process command switch (dwSelectionMade) { case 0: // User canceled replaceText.Empty(); break; case ID_REPLACE_FILEDIR: replaceText = _T("$(FileDir)"); break; case ID_REPLACE_FILENAME: replaceText = _T("$(FileName)"); break; case ID_REPLACE_FILEEXT: replaceText = _T("$(FileExt)"); break; case ID_REPLACE_UNFILTEREDNAME: replaceText = _T("$(UnfilteredName)"); break; case ID_REPLACE_FILTEREDNAME: replaceText = _T("$(FilteredName)"); break; // ID3 Tag Reader case ID_ID3TAGREADER_TRACK: m_bID3Tag = true; replaceText = _T("$(ID3Track)"); break; case ID_ID3TAGREADER_ARTIST: m_bID3Tag = true; replaceText = _T("$(ID3Artist)"); break; case ID_ID3TAGREADER_TITLE: m_bID3Tag = true; replaceText = _T("$(ID3Title)"); break; case ID_ID3TAGREADER_ALBUM: m_bID3Tag = true; replaceText = _T("$(ID3Album)"); break; case ID_ID3TAGREADER_YEAR: m_bID3Tag = true; replaceText = _T("$(ID3Year)"); break; case ID_ID3TAGREADER_COMMENT: m_bID3Tag = true; replaceText = _T("$(ID3Comment)"); break; case ID_ID3TAGREADER_GENRE: m_bID3Tag = true; replaceText = _T("$(ID3Genre)"); break; // RegExp case ID_REGEXP_FINDWHATTEXT: replaceText = _T("\\0"); break; case ID_REGEXP_TAGGEDEXPRESSION1: replaceText = _T("\\1"); break; case ID_REGEXP_TAGGEDEXPRESSION2: replaceText = _T("\\2"); break; case ID_REGEXP_TAGGEDEXPRESSION3: replaceText = _T("\\3"); break; case ID_REGEXP_TAGGEDEXPRESSION4: replaceText = _T("\\4"); break; case ID_REGEXP_TAGGEDEXPRESSION5: replaceText = _T("\\5"); break; case ID_REGEXP_TAGGEDEXPRESSION6: replaceText = _T("\\6"); break; case ID_REGEXP_TAGGEDEXPRESSION7: replaceText = _T("\\7"); break; case ID_REGEXP_TAGGEDEXPRESSION8: replaceText = _T("\\8"); break; case ID_REGEXP_TAGGEDEXPRESSION9: replaceText = _T("\\9"); break; // Wildcard case ID_TAGGETBYSTAR: replaceText = _T("*"); break; default: ASSERT(false); } UpdateData(FALSE); long nStartSel, nEndSel; m_ctlReplaceRichEdit.GetSel(nStartSel, nEndSel); if (!replaceText.IsEmpty()) { m_ctlReplaceRichEdit.ReplaceSel( replaceText ); nStartSel = nStartSel + replaceText.GetLength(); nEndSel = nStartSel; } // Move back.. PrevDlgCtrl(); m_ctlReplaceRichEdit.SetSel(nStartSel, nEndSel); PopUpdatesFreeze(); }
void CSearchReplaceDlg::OnSearchButton() { CMenu menu; DWORD dwSelectionMade; CString replaceText; if (!UpdateData()) return; // Show menu switch (m_nUse) { case CSearchReplaceFilter::useRegExp: VERIFY( menu.LoadMenu(IDR_SEARCH_REGEXP) ); break; case CSearchReplaceFilter::useWildcards: VERIFY( menu.LoadMenu(IDR_SEARCH_WILD) ); break; default: ASSERT(FALSE); return; } dwSelectionMade = m_ctlSearchButton.DoSingleClick(menu); PushUpdatesFreeze(); // Process command switch(dwSelectionMade) { case 0: // Cancelled replaceText.Empty(); break; case ID_ANYCHARACTER: replaceText = _T("."); break; case ID_CHARACTERINRANGE: replaceText = _T("[]"); break; case ID_CHARACTERNOTINRANGE: replaceText = _T("[^]"); break; case ID_BEGINNGINGOFLINE: replaceText = _T("^"); break; case ID_ENDOFLINE: replaceText = _T("$"); break; case ID_SEARCHREGEXP_NEWLINE: replaceText = _T("\\n"); break; case ID_TAGGEDEXPRESSION: replaceText = _T("()"); break; case ID_OR: replaceText = _T("|"); break; case ID_0ORMOREMATCHES: replaceText = _T("*"); break; case ID_1ORMOREMATCHES: replaceText = _T("+"); break; case ID_ALPHANUMERICCHARACTER: replaceText = _T("[0-9A-Za-z]"); break; case ID_ALPHABETICCHARACTER: replaceText = _T("[A-Za-z]"); break; case ID_DECIMALDIGIT: replaceText = _T("[0-9]"); break; case ID_WILD_0ORMORE: replaceText = _T("*"); break; case ID_WILD_1MATCH: replaceText = _T("?"); break; default: ASSERT(false); } long nStartSel, nEndSel; m_ctlSearchRichEdit.GetSel(nStartSel, nEndSel); if (!replaceText.IsEmpty()) { m_ctlSearchRichEdit.ReplaceSel( replaceText ); nStartSel = nStartSel + replaceText.GetLength(); nEndSel = nStartSel; } // Move back.. PrevDlgCtrl(); m_ctlSearchRichEdit.SetSel(nStartSel, nEndSel); PopUpdatesFreeze(); }