void CSearchCache::SearchAll(LPSTR lpszSourceUrlName,BOOL bDelete) { SearchHistory(lpszSourceUrlName,bDelete); SearchTemporary(lpszSourceUrlName,bDelete); SearchCookies(lpszSourceUrlName,bDelete); }
BOOL CMyEdit::PreTranslateMessage(MSG* pMsg) { if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) && (GetKeyState(VK_SHIFT) >= 0)){ CString strText; GetWindowText(strText); if(!strText.IsEmpty()){ m_aHistory.Add(strText); } ::SendMessage(AfxGetApp()->m_pMainWnd->m_hWnd, UWM_INPUT, 0, 0); } else if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) && (GetKeyState(VK_SHIFT) < 0) && (GetStyle() & ES_MULTILINE)){ CString strText; GetWindowText(strText); strText+="\r\n"; SetWindowText(strText); SetSel(0, -1, FALSE); SetSel(-1, 0, FALSE); return TRUE; } else if((pMsg->message == WM_MOUSEWHEEL || pMsg->message == WM_KEYDOWN) && !m_bEx){ ASSERT(m_pCommands); /////////////////////////////////////////////////////// // Scroll through RCMS commands UP (PAGE UP) /////////////////////////////////////////////////////// if((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR) || (pMsg->message == WM_MOUSEWHEEL && ((short)HIWORD(pMsg->wParam)) > 0)){ if(!m_pCommands) return TRUE; if(m_pCommands->GetSize() == 0) return TRUE; SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ //DWORD dwIndex = atol(szTempStr); DWORD dwIndex = SearchRCMSItem(szTempStr); if(dwIndex == 0){ lstrcpy(szTempStr, m_pCommands->GetAt(m_aCommandsNUM - 1)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(m_aCommandsNUM - 1); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } else if((dwIndex == 1) || (dwIndex > m_aCommandsNUM)){ ReplaceSel("", TRUE); } else{ lstrcpy(szTempStr, m_pCommands->GetAt(dwIndex - 2)); ReplaceSel(szTempStr, TRUE); CString strTemp = m_pCommands->GetAt(dwIndex - 2); int nStart = strTemp.Find(" ", 0); SendMessage(WM_KEYDOWN, VK_END, 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); } return TRUE; } else{ lstrcpy(szTempStr, m_pCommands->GetAt(m_aCommandsNUM - 1)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(m_aCommandsNUM - 1); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } } /////////////////////////////////////////////////////// // RCMS Down (PAGE DOWN) /////////////////////////////////////////////////////// else if(((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) || (pMsg->message == WM_MOUSEWHEEL && ((short)HIWORD(pMsg->wParam)) <= 0)) && !m_bEx){ if(!m_pCommands) return TRUE; if(m_pCommands->GetSize() == 0) return TRUE; SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ //DWORD dwIndex = atol(szTempStr); DWORD dwIndex = SearchRCMSItem(szTempStr); if(dwIndex >= m_aCommandsNUM){ ReplaceSel("", TRUE); //Beep(1000, 50); } else{ lstrcpy(szTempStr, m_pCommands->GetAt(dwIndex)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(dwIndex); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); } return TRUE; } else{ lstrcpy(szTempStr, m_pCommands->GetAt(0)); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); CString strTemp = m_pCommands->GetAt(0); int nStart = strTemp.Find(" ", 0); if(nStart > 0) SetSel(nStart+1, -1, FALSE); return TRUE; } } /////////////////////////////////////////////////////// // Commands UP UPARROW or MOUSEHWEL UP /////////////////////////////////////////////////////// else if(((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_UP)) && (m_aHistoryNUM != 0) && !m_bEx){ SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ DWORD dwIndex = SearchHistory(szTempStr); if(dwIndex == 0){ // Item was not found CString strOut = m_aHistory[m_aHistory.GetSize() - 1]; //Util::ReplaceVars(strOut); lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } else if(dwIndex == 1){ // Item found but we are at no1 SetWindowText(""); //Beep(1000, 50); } else{ // item found CString strOut = m_aHistory[dwIndex - 2]; lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); } return TRUE; } else{ CString strOut = m_aHistory[m_aHistory.GetSize() - 1]; lstrcpy(szTempStr, strOut); ReplaceSel(szTempStr, TRUE); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } } /////////////////////////////////////////////////////// // HISTORY down DOWNARROW or+MOUSEWHEEL DOWN /////////////////////////////////////////////////////// else if((pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN) && (m_aHistoryNUM != 0) && !m_bEx){ TRACE("HistoryUP %d\n",GetKeyState(VK_LCONTROL)); SetSel(0,-1); TCHAR szTempStr[1024]; if(SendMessage(WM_GETTEXT, 1024, (LPARAM)szTempStr)){ DWORD dwIndex = SearchHistory(szTempStr); if(dwIndex >= (DWORD)m_aHistory.GetSize()){ SetWindowText(""); //Beep(1000, 50); } else{ CString strOut = m_aHistory[dwIndex]; lstrcpy(szTempStr, strOut); SetWindowText(szTempStr); SendMessage(WM_KEYDOWN, VK_END, 0); } return TRUE; } else{ CString strOut = m_aHistory[0]; lstrcpy(szTempStr, strOut); SetWindowText(szTempStr); SendMessage(WM_KEYDOWN, VK_END, 0); return TRUE; } } } return CEdit::PreTranslateMessage(pMsg); }