BOOL AbstractSpellerInterface::CheckWord (char *Word) { char *Buf = 0; switch (CurrentEncoding) { case ENCODING_UTF8: SetString (Buf, Word); break; case ENCODING_ANSI: SetStringDUtf8 (Buf, Word); break; case ENCODING_WCHAR: SetStringDUtf8 (Buf, (wchar_t *)Word); break; } if (Ignored->find (Buf) != Ignored->end ()) { CLEAN_AND_ZERO_ARR (Buf); return TRUE; } CLEAN_AND_ZERO_ARR (Buf); return SpellerCheckWord (Word); }
void SelectProxy::ApplyChoice (SpellChecker *SpellCheckerInstance) { TCHAR *TBuf = 0; size_t BufSize = 0; BufSize = Edit_GetTextLength (HUserName) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HUserName, TBuf, BufSize); SpellCheckerInstance->SetProxyUserName (TBuf); CLEAN_AND_ZERO_ARR (TBuf); BufSize = Edit_GetTextLength (HHostName) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HHostName, TBuf, BufSize); SpellCheckerInstance->SetProxyHostName (TBuf); CLEAN_AND_ZERO_ARR (TBuf); BufSize = Edit_GetTextLength (HPassword) + 1; TBuf = new TCHAR [BufSize]; Edit_GetText (HPassword, TBuf, BufSize); SpellCheckerInstance->SetProxyPassword (TBuf); CLEAN_AND_ZERO_ARR (TBuf); SpellCheckerInstance->SetUseProxy (Button_GetCheck (HUseProxy)); SpellCheckerInstance->SetProxyAnonymous (Button_GetCheck (HProxyAnonymous)); SpellCheckerInstance->SetProxyType (ComboBox_GetCurSel (HProxyType)); TBuf = new TCHAR[DEFAULT_BUF_SIZE]; Edit_GetText (HPort, TBuf, DEFAULT_BUF_SIZE); TCHAR *EndPtr; int x = _tcstol (TBuf, &EndPtr, 10); SpellCheckerInstance->SetProxyPort (x); CLEAN_AND_ZERO_ARR (TBuf); GetDownloadDics ()->Refresh (); }
void LangListDialog::update() { if (!isCreated ()) return; auto status = getSpellChecker()->getStatus(); ListBox_ResetContent(HLangList); for (auto &lang : status->languageList) ListBox_AddString(HLangList, lang.aliasName.c_str ()); auto settingsCopy = *getSpellChecker()->getSettings(); wchar_t *multiLangCopy = nullptr; wchar_t *context = nullptr; setString (multiLangCopy, settingsCopy.spellerSettings[SpellerType::hunspell].activeMultiLanguage.data ()); int index = 0; auto token = _tcstok_s(multiLangCopy, _T ("|"), &context); while (token) { index = -1; for (int i = 0; i < static_cast<int> (status->languageList.size ()); ++i) { if (status->languageList[i].originalName == token) { index = i; break; } } if (index != -1) CheckedListBox_SetCheckState(HLangList, index, BST_CHECKED); token = _tcstok_s(NULL, _T ("|"), &context); } CLEAN_AND_ZERO_ARR (multiLangCopy); }
BOOL CALLBACK AboutDlg::run_dlgProc (UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { TCHAR *Ver = 0; GetProductAndVersion (Ver); Static_SetText (::GetDlgItem(_hSelf, IDC_VERSION), Ver); CLEAN_AND_ZERO_ARR (Ver); } return TRUE; case WM_NOTIFY: { switch (((LPNMHDR)lParam)->code) { case NM_CLICK: // Fall through to the next case. case NM_RETURN: { PNMLINK pNMLink = (PNMLINK)lParam; LITEM item = pNMLink->item; ShellExecute(NULL, _T ("open"), item.szUrl, NULL, NULL, SW_SHOW); return TRUE; } } return FALSE; } break; case WM_COMMAND: { switch (LOWORD (wParam)) { case IDOK: case IDCANCEL: if (HIWORD (wParam) == BN_CLICKED) { display (false); return TRUE; } } } break; } return FALSE; }
bool GetProductAndVersion (TCHAR *&strProductVersion) { // get the filename of the executable containing the version resource TCHAR szFilename[MAX_PATH + 1] = {0}; if (GetModuleFileName ((HMODULE) getHModule (), szFilename, MAX_PATH) == 0) { return false; } // allocate a block of memory for the version info DWORD dummy; DWORD dwSize = GetFileVersionInfoSize(szFilename, &dummy); if (dwSize == 0) { return false; } std::vector<BYTE> data(dwSize); // load the version info if (!GetFileVersionInfo(szFilename, NULL, dwSize, &data[0])) { return false; } UINT uiVerLen = 0; VS_FIXEDFILEINFO* pFixedInfo = 0; // pointer to fixed file info structure // get the fixed file info (language-independent) if(VerQueryValue(&data[0], TEXT("\\"), (void**)&pFixedInfo, (UINT *)&uiVerLen) == 0) { return false; } CLEAN_AND_ZERO_ARR (strProductVersion); strProductVersion = new TCHAR[DEFAULT_BUF_SIZE]; _stprintf (strProductVersion, _T ("Version: %u.%u.%u.%u"), HIWORD (pFixedInfo->dwProductVersionMS), LOWORD (pFixedInfo->dwProductVersionMS), HIWORD (pFixedInfo->dwProductVersionLS), LOWORD (pFixedInfo->dwProductVersionLS)); return true; }
void LangListDialog::ApplyChoice(SpellChecker *spellCheckerInstance) { int count = ListBox_GetCount(HLangList); TCHAR Buf[DEFAULT_BUF_SIZE]; TCHAR *ItemBuf = 0; BOOL FirstOne = TRUE; Buf[0] = _T('\0'); for (int i = 0; i < count; i++) { if (CheckedListBox_GetCheckState(HLangList, i)) { setString(ItemBuf, spellCheckerInstance->GetLangByIndex(i)); if (!FirstOne) _tcscat(Buf, _T ("|")); _tcscat_s(Buf, ItemBuf); FirstOne = FALSE; } } auto settingsCopy = std::make_unique<SettingsData>(*spellCheckerInstance->getSettings()); settingsCopy->spellerSettings[settingsCopy->activeSpellerType] .activeMultiLanguage = Buf; PostMessageToMainThread(TM_SETTINGS_CHANGED, reinterpret_cast<WPARAM>(settingsCopy.release())); CLEAN_AND_ZERO_ARR(ItemBuf); }
BOOL LoadAspell (TCHAR *PathArg) { TCHAR *Path = 0; GetActualAspellPath (Path, PathArg); /* if (hInstLib) { FreeLibrary (hInstLib); hInstLib = 0; } */ hInstLib = LoadLibrary (Path); CLEAN_AND_ZERO_ARR (Path); BOOL bRet = FALSE; if (hInstLib != NULL) { aspell_mutable_container_add = (PFUNC_aspell_mutable_container_add )GetProcAddress(hInstLib, "aspell_mutable_container_add"); aspell_mutable_container_remove = (PFUNC_aspell_mutable_container_remove )GetProcAddress(hInstLib, "aspell_mutable_container_remove"); aspell_mutable_container_clear = (PFUNC_aspell_mutable_container_clear )GetProcAddress(hInstLib, "aspell_mutable_container_clear"); aspell_mutable_container_to_mutable_container = (PFUNC_aspell_mutable_container_to_mutable_container)GetProcAddress(hInstLib, "aspell_mutable_container_to_mutable_container"); aspell_key_info_enumeration_at_end = (PFUNC_aspell_key_info_enumeration_at_end )GetProcAddress(hInstLib, "aspell_key_info_enumeration_at_end"); aspell_key_info_enumeration_next = (PFUNC_aspell_key_info_enumeration_next )GetProcAddress(hInstLib, "aspell_key_info_enumeration_next"); delete_aspell_key_info_enumeration = (PFUNC_delete_aspell_key_info_enumeration )GetProcAddress(hInstLib, "delete_aspell_key_info_enumeration"); aspell_key_info_enumeration_clone = (PFUNC_aspell_key_info_enumeration_clone )GetProcAddress(hInstLib, "aspell_key_info_enumeration_clone"); aspell_key_info_enumeration_assign = (PFUNC_aspell_key_info_enumeration_assign )GetProcAddress(hInstLib, "aspell_key_info_enumeration_assign"); new_aspell_config = (PFUNC_new_aspell_config )GetProcAddress(hInstLib, "new_aspell_config"); delete_aspell_config = (PFUNC_delete_aspell_config )GetProcAddress(hInstLib, "delete_aspell_config"); aspell_config_clone = (PFUNC_aspell_config_clone )GetProcAddress(hInstLib, "aspell_config_clone"); aspell_config_assign = (PFUNC_aspell_config_assign )GetProcAddress(hInstLib, "aspell_config_assign"); aspell_config_error_number = (PFUNC_aspell_config_error_number )GetProcAddress(hInstLib, "aspell_config_error_number"); aspell_config_error_message = (PFUNC_aspell_config_error_message )GetProcAddress(hInstLib, "aspell_config_error_message"); aspell_config_error = (PFUNC_aspell_config_error )GetProcAddress(hInstLib, "aspell_config_error"); aspell_config_set_extra = (PFUNC_aspell_config_set_extra )GetProcAddress(hInstLib, "aspell_config_set_extra"); aspell_config_keyinfo = (PFUNC_aspell_config_keyinfo )GetProcAddress(hInstLib, "aspell_config_keyinfo"); aspell_config_possible_elements = (PFUNC_aspell_config_possible_elements )GetProcAddress(hInstLib, "aspell_config_possible_elements"); aspell_config_get_default = (PFUNC_aspell_config_get_default )GetProcAddress(hInstLib, "aspell_config_get_default"); aspell_config_elements = (PFUNC_aspell_config_elements )GetProcAddress(hInstLib, "aspell_config_elements"); aspell_config_replace = (PFUNC_aspell_config_replace )GetProcAddress(hInstLib, "aspell_config_replace"); aspell_config_remove = (PFUNC_aspell_config_remove )GetProcAddress(hInstLib, "aspell_config_remove"); aspell_config_have = (PFUNC_aspell_config_have )GetProcAddress(hInstLib, "aspell_config_have"); aspell_config_retrieve = (PFUNC_aspell_config_retrieve )GetProcAddress(hInstLib, "aspell_config_retrieve"); aspell_config_retrieve_list = (PFUNC_aspell_config_retrieve_list )GetProcAddress(hInstLib, "aspell_config_retrieve_list"); aspell_config_retrieve_bool = (PFUNC_aspell_config_retrieve_bool )GetProcAddress(hInstLib, "aspell_config_retrieve_bool"); aspell_config_retrieve_int = (PFUNC_aspell_config_retrieve_int )GetProcAddress(hInstLib, "aspell_config_retrieve_int"); aspell_error_number = (PFUNC_aspell_error_number )GetProcAddress(hInstLib, "aspell_error_number"); aspell_error_message = (PFUNC_aspell_error_message )GetProcAddress(hInstLib, "aspell_error_message"); aspell_error = (PFUNC_aspell_error )GetProcAddress(hInstLib, "aspell_error"); delete_aspell_can_have_error = (PFUNC_delete_aspell_can_have_error )GetProcAddress(hInstLib, "delete_aspell_can_have_error"); new_aspell_speller = (PFUNC_new_aspell_speller )GetProcAddress(hInstLib, "new_aspell_speller"); to_aspell_speller = (PFUNC_to_aspell_speller )GetProcAddress(hInstLib, "to_aspell_speller"); delete_aspell_speller = (PFUNC_delete_aspell_speller )GetProcAddress(hInstLib, "delete_aspell_speller"); aspell_speller_error_number = (PFUNC_aspell_speller_error_number )GetProcAddress(hInstLib, "aspell_speller_error_number"); aspell_speller_error_message = (PFUNC_aspell_speller_error_message )GetProcAddress(hInstLib, "aspell_speller_error_message"); aspell_speller_error = (PFUNC_aspell_speller_error )GetProcAddress(hInstLib, "aspell_speller_error"); aspell_speller_config = (PFUNC_aspell_speller_config )GetProcAddress(hInstLib, "aspell_speller_config"); aspell_speller_check = (PFUNC_aspell_speller_check )GetProcAddress(hInstLib, "aspell_speller_check"); aspell_speller_add_to_personal = (PFUNC_aspell_speller_add_to_personal )GetProcAddress(hInstLib, "aspell_speller_add_to_personal"); aspell_speller_add_to_session = (PFUNC_aspell_speller_add_to_session )GetProcAddress(hInstLib, "aspell_speller_add_to_session"); aspell_speller_personal_word_list = (PFUNC_aspell_speller_personal_word_list )GetProcAddress(hInstLib, "aspell_speller_personal_word_list"); aspell_speller_session_word_list = (PFUNC_aspell_speller_session_word_list )GetProcAddress(hInstLib, "aspell_speller_session_word_list"); aspell_speller_main_word_list = (PFUNC_aspell_speller_main_word_list )GetProcAddress(hInstLib, "aspell_speller_main_word_list"); aspell_speller_save_all_word_lists = (PFUNC_aspell_speller_save_all_word_lists )GetProcAddress(hInstLib, "aspell_speller_save_all_word_lists"); aspell_speller_clear_session = (PFUNC_aspell_speller_clear_session )GetProcAddress(hInstLib, "aspell_speller_clear_session"); aspell_speller_suggest = (PFUNC_aspell_speller_suggest )GetProcAddress(hInstLib, "aspell_speller_suggest"); aspell_speller_store_replacement = (PFUNC_aspell_speller_store_replacement )GetProcAddress(hInstLib, "aspell_speller_store_replacement"); delete_aspell_filter = (PFUNC_delete_aspell_filter )GetProcAddress(hInstLib, "delete_aspell_filter"); aspell_filter_error_number = (PFUNC_aspell_filter_error_number )GetProcAddress(hInstLib, "aspell_filter_error_number"); aspell_filter_error_message = (PFUNC_aspell_filter_error_message )GetProcAddress(hInstLib, "aspell_filter_error_message"); aspell_filter_error = (PFUNC_aspell_filter_error )GetProcAddress(hInstLib, "aspell_filter_error"); to_aspell_filter = (PFUNC_to_aspell_filter )GetProcAddress(hInstLib, "to_aspell_filter"); delete_aspell_document_checker = (PFUNC_delete_aspell_document_checker )GetProcAddress(hInstLib, "delete_aspell_document_checker"); aspell_document_checker_error_number = (PFUNC_aspell_document_checker_error_number )GetProcAddress(hInstLib, "aspell_document_checker_error_number"); aspell_document_checker_error_message = (PFUNC_aspell_document_checker_error_message )GetProcAddress(hInstLib, "aspell_document_checker_error_message"); aspell_document_checker_error = (PFUNC_aspell_document_checker_error )GetProcAddress(hInstLib, "aspell_document_checker_error"); new_aspell_document_checker = (PFUNC_new_aspell_document_checker )GetProcAddress(hInstLib, "new_aspell_document_checker"); to_aspell_document_checker = (PFUNC_to_aspell_document_checker )GetProcAddress(hInstLib, "to_aspell_document_checker"); aspell_document_checker_reset = (PFUNC_aspell_document_checker_reset )GetProcAddress(hInstLib, "aspell_document_checker_reset"); aspell_document_checker_process = (PFUNC_aspell_document_checker_process )GetProcAddress(hInstLib, "aspell_document_checker_process"); aspell_document_checker_next_misspelling = (PFUNC_aspell_document_checker_next_misspelling )GetProcAddress(hInstLib, "aspell_document_checker_next_misspelling"); aspell_document_checker_filter = (PFUNC_aspell_document_checker_filter )GetProcAddress(hInstLib, "aspell_document_checker_filter"); aspell_word_list_empty = (PFUNC_aspell_word_list_empty )GetProcAddress(hInstLib, "aspell_word_list_empty"); aspell_word_list_size = (PFUNC_aspell_word_list_size )GetProcAddress(hInstLib, "aspell_word_list_size"); aspell_word_list_elements = (PFUNC_aspell_word_list_elements )GetProcAddress(hInstLib, "aspell_word_list_elements"); delete_aspell_string_enumeration = (PFUNC_delete_aspell_string_enumeration )GetProcAddress(hInstLib, "delete_aspell_string_enumeration"); aspell_string_enumeration_clone = (PFUNC_aspell_string_enumeration_clone )GetProcAddress(hInstLib, "aspell_string_enumeration_clone"); aspell_string_enumeration_assign = (PFUNC_aspell_string_enumeration_assign )GetProcAddress(hInstLib, "aspell_string_enumeration_assign"); aspell_string_enumeration_at_end = (PFUNC_aspell_string_enumeration_at_end )GetProcAddress(hInstLib, "aspell_string_enumeration_at_end"); aspell_string_enumeration_next = (PFUNC_aspell_string_enumeration_next )GetProcAddress(hInstLib, "aspell_string_enumeration_next"); get_aspell_module_info_list = (PFUNC_get_aspell_module_info_list )GetProcAddress(hInstLib, "get_aspell_module_info_list"); aspell_module_info_list_empty = (PFUNC_aspell_module_info_list_empty )GetProcAddress(hInstLib, "aspell_module_info_list_empty"); aspell_module_info_list_size = (PFUNC_aspell_module_info_list_size )GetProcAddress(hInstLib, "aspell_module_info_list_size"); aspell_module_info_list_elements = (PFUNC_aspell_module_info_list_elements )GetProcAddress(hInstLib, "aspell_module_info_list_elements"); get_aspell_dict_info_list = (PFUNC_get_aspell_dict_info_list )GetProcAddress(hInstLib, "get_aspell_dict_info_list"); aspell_dict_info_list_empty = (PFUNC_aspell_dict_info_list_empty )GetProcAddress(hInstLib, "aspell_dict_info_list_empty"); aspell_dict_info_list_size = (PFUNC_aspell_dict_info_list_size )GetProcAddress(hInstLib, "aspell_dict_info_list_size"); aspell_dict_info_list_elements = (PFUNC_aspell_dict_info_list_elements )GetProcAddress(hInstLib, "aspell_dict_info_list_elements"); aspell_module_info_enumeration_at_end = (PFUNC_aspell_module_info_enumeration_at_end )GetProcAddress(hInstLib, "aspell_module_info_enumeration_at_end"); aspell_module_info_enumeration_next = (PFUNC_aspell_module_info_enumeration_next )GetProcAddress(hInstLib, "aspell_module_info_enumeration_next"); delete_aspell_module_info_enumeration = (PFUNC_delete_aspell_module_info_enumeration )GetProcAddress(hInstLib, "delete_aspell_module_info_enumeration"); aspell_module_info_enumeration_clone = (PFUNC_aspell_module_info_enumeration_clone )GetProcAddress(hInstLib, "aspell_module_info_enumeration_clone"); aspell_module_info_enumeration_assign = (PFUNC_aspell_module_info_enumeration_assign )GetProcAddress(hInstLib, "aspell_module_info_enumeration_assign"); aspell_dict_info_enumeration_at_end = (PFUNC_aspell_dict_info_enumeration_at_end )GetProcAddress(hInstLib, "aspell_dict_info_enumeration_at_end"); aspell_dict_info_enumeration_next = (PFUNC_aspell_dict_info_enumeration_next )GetProcAddress(hInstLib, "aspell_dict_info_enumeration_next"); delete_aspell_dict_info_enumeration = (PFUNC_delete_aspell_dict_info_enumeration )GetProcAddress(hInstLib, "delete_aspell_dict_info_enumeration"); aspell_dict_info_enumeration_clone = (PFUNC_aspell_dict_info_enumeration_clone )GetProcAddress(hInstLib, "aspell_dict_info_enumeration_clone"); aspell_dict_info_enumeration_assign = (PFUNC_aspell_dict_info_enumeration_assign )GetProcAddress(hInstLib, "aspell_dict_info_enumeration_assign"); new_aspell_string_list = (PFUNC_new_aspell_string_list )GetProcAddress(hInstLib, "new_aspell_string_list"); aspell_string_list_empty = (PFUNC_aspell_string_list_empty )GetProcAddress(hInstLib, "aspell_string_list_empty"); aspell_string_list_size = (PFUNC_aspell_string_list_size )GetProcAddress(hInstLib, "aspell_string_list_size"); aspell_string_list_elements = (PFUNC_aspell_string_list_elements )GetProcAddress(hInstLib, "aspell_string_list_elements"); aspell_string_list_add = (PFUNC_aspell_string_list_add )GetProcAddress(hInstLib, "aspell_string_list_add"); aspell_string_list_remove = (PFUNC_aspell_string_list_remove )GetProcAddress(hInstLib, "aspell_string_list_remove"); aspell_string_list_clear = (PFUNC_aspell_string_list_clear )GetProcAddress(hInstLib, "aspell_string_list_clear"); aspell_string_list_to_mutable_container = (PFUNC_aspell_string_list_to_mutable_container )GetProcAddress(hInstLib, "aspell_string_list_to_mutable_container"); delete_aspell_string_list = (PFUNC_delete_aspell_string_list )GetProcAddress(hInstLib, "delete_aspell_string_list"); aspell_string_list_clone = (PFUNC_aspell_string_list_clone )GetProcAddress(hInstLib, "aspell_string_list_clone"); aspell_string_list_assign = (PFUNC_aspell_string_list_assign )GetProcAddress(hInstLib, "aspell_string_list_assign"); new_aspell_string_map = (PFUNC_new_aspell_string_map )GetProcAddress(hInstLib, "new_aspell_string_map"); aspell_string_map_add = (PFUNC_aspell_string_map_add )GetProcAddress(hInstLib, "aspell_string_map_add"); aspell_string_map_remove = (PFUNC_aspell_string_map_remove )GetProcAddress(hInstLib, "aspell_string_map_remove"); aspell_string_map_clear = (PFUNC_aspell_string_map_clear )GetProcAddress(hInstLib, "aspell_string_map_clear"); aspell_string_map_to_mutable_container = (PFUNC_aspell_string_map_to_mutable_container )GetProcAddress(hInstLib, "aspell_string_map_to_mutable_container"); delete_aspell_string_map = (PFUNC_delete_aspell_string_map )GetProcAddress(hInstLib, "delete_aspell_string_map"); aspell_string_map_clone = (PFUNC_aspell_string_map_clone )GetProcAddress(hInstLib, "aspell_string_map_clone"); aspell_string_map_assign = (PFUNC_aspell_string_map_assign )GetProcAddress(hInstLib, "aspell_string_map_assign"); aspell_string_map_empty = (PFUNC_aspell_string_map_empty )GetProcAddress(hInstLib, "aspell_string_map_empty"); aspell_string_map_size = (PFUNC_aspell_string_map_size )GetProcAddress(hInstLib, "aspell_string_map_size"); aspell_string_map_elements = (PFUNC_aspell_string_map_elements )GetProcAddress(hInstLib, "aspell_string_map_elements"); aspell_string_map_insert = (PFUNC_aspell_string_map_insert )GetProcAddress(hInstLib, "aspell_string_map_insert"); aspell_string_map_replace = (PFUNC_aspell_string_map_replace )GetProcAddress(hInstLib, "aspell_string_map_replace"); aspell_string_map_lookup = (PFUNC_aspell_string_map_lookup )GetProcAddress(hInstLib, "aspell_string_map_lookup"); aspell_string_pair_enumeration_at_end = (PFUNC_aspell_string_pair_enumeration_at_end )GetProcAddress(hInstLib, "aspell_string_pair_enumeration_at_end"); aspell_string_pair_enumeration_next = (PFUNC_aspell_string_pair_enumeration_next )GetProcAddress(hInstLib, "aspell_string_pair_enumeration_next"); delete_aspell_string_pair_enumeration = (PFUNC_delete_aspell_string_pair_enumeration )GetProcAddress(hInstLib, "delete_aspell_string_pair_enumeration"); aspell_string_pair_enumeration_clone = (PFUNC_aspell_string_pair_enumeration_clone )GetProcAddress(hInstLib, "aspell_string_pair_enumeration_clone"); aspell_string_pair_enumeration_assign = (PFUNC_aspell_string_pair_enumeration_assign )GetProcAddress(hInstLib, "aspell_string_pair_enumeration_assign"); if (!new_aspell_config) // TODO: Add check for all used functions return FALSE; bRet = TRUE; } return bRet; }