diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-01 08:43:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-01 08:43:08 +0000 |
commit | 86802925857034fec1fbfb5c0eb668e996b0518d (patch) | |
tree | 68d51590b10b9416c1e2d1bd652a00ce5807da4e /plugins/SpellChecker/src | |
parent | 14517f8c04b030e4e46f6eb1167a073ef7a1ae51 (diff) |
finally mir_icons removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@2578 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker/src')
-rw-r--r-- | plugins/SpellChecker/src/ardialog.cpp | 135 | ||||
-rw-r--r-- | plugins/SpellChecker/src/commons.h | 3 | ||||
-rw-r--r-- | plugins/SpellChecker/src/dictionary.h | 1 | ||||
-rw-r--r-- | plugins/SpellChecker/src/options.cpp | 5 | ||||
-rw-r--r-- | plugins/SpellChecker/src/spellchecker.cpp | 211 |
5 files changed, 145 insertions, 210 deletions
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 8ef67f06cb..507f74329b 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -178,28 +178,25 @@ static void Close(HWND hwndDlg, int ret) static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TranslateDialogDefault(hwndDlg);
-
Data *data = (Data *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) data);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_USERDATA, (LONG_PTR) data);
data->old_edit_proc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_WNDPROC,
- (LONG_PTR) OnlyCharsEditProc);
+ (LONG_PTR) OnlyCharsEditProc);
- HICON hIcon = IcoLib_LoadIcon("spellchecker_enabled");
+ HICON hIcon = Skin_GetIcon("spellchecker_enabled");
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
Skin_ReleaseIcon(hIcon);
SendDlgItemMessage(hwndDlg, IDC_OLD, EM_LIMITTEXT, 256, 0);
SendDlgItemMessage(hwndDlg, IDC_NEW, EM_LIMITTEXT, 256, 0);
- if (!data->find.empty())
- {
+ if (!data->find.empty()) {
scoped_free<TCHAR> tmp = data->dict->autoReplace->filterText(data->find.c_str());
SetDlgItemText(hwndDlg, IDC_OLD, tmp);
}
@@ -208,14 +205,12 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa CheckDlgButton(hwndDlg, IDC_VARIABLES, data->useVariables ? BST_CHECKED : BST_UNCHECKED);
- if (data->findReadOnly)
- {
+ if (data->findReadOnly) {
SendDlgItemMessage(hwndDlg, IDC_OLD, EM_SETREADONLY, TRUE, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_OLD_PS), FALSE);
}
- if (!variables_enabled)
- {
+ if (!variables_enabled) {
ShowWindow(GetDlgItem(hwndDlg, IDC_VARIABLES), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_VAR_HELP), FALSE);
@@ -226,90 +221,74 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa rc_new.right = rc_old.right;
SetWindowPos(GetDlgItem(hwndDlg, IDC_NEW), NULL, 0, 0,
- rc_new.right - rc_new.left, rc_new.bottom - rc_new.top,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER);
+ rc_new.right - rc_new.left, rc_new.bottom - rc_new.top,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER);
}
- else
- {
+ else {
variables_skin_helpbutton(hwndDlg, IDC_VAR_HELP);
EnableWindow(GetDlgItem(hwndDlg, IDC_VAR_HELP), IsDlgButtonChecked(hwndDlg, IDC_VARIABLES));
}
CenterParent(hwndDlg);
-
- return TRUE;
}
+ return TRUE;
- case WM_COMMAND:
- switch(wParam)
+ case WM_COMMAND:
+ switch(wParam) {
+ case IDOK:
{
- case IDOK:
- {
- Data *data = (Data *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- TCHAR find[256];
- if (data->findReadOnly)
- {
- lstrcpyn(find, data->find.c_str(), SIZEOF(find));
- }
- else
- {
- GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
- lstrtrim(find);
- }
-
- TCHAR replace[256];
- GetDlgItemText(hwndDlg, IDC_NEW, replace, SIZEOF(replace));
- lstrtrim(replace);
-
- if (!data->findReadOnly && find[0] == 0)
- {
- MessageBox(hwndDlg, TranslateT("The wrong word can't be empty!"), TranslateT("Wrong Correction"),
- MB_OK | MB_ICONERROR);
- }
- else if (replace[0] == 0)
- {
- MessageBox(hwndDlg, TranslateT("The correction can't be empty!"), TranslateT("Wrong Correction"),
- MB_OK | MB_ICONERROR);
- }
- else if (_tcscmp(find, replace) == 0)
- {
- MessageBox(hwndDlg, TranslateT("The correction can't be equal to the wrong word!"), TranslateT("Wrong Correction"),
- MB_OK | MB_ICONERROR);
- }
- else
- {
- data->callback(FALSE, data->dict,
- find, replace, IsDlgButtonChecked(hwndDlg, IDC_VARIABLES),
- data->find.c_str(), data->param);
- Close(hwndDlg, 1);
- }
-
- break;
+ Data *data = (Data *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ TCHAR find[256];
+ if (data->findReadOnly)
+ lstrcpyn(find, data->find.c_str(), SIZEOF(find));
+ else {
+ GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
+ lstrtrim(find);
}
- case IDCANCEL:
- {
- Close(hwndDlg, 0);
- break;
+
+ TCHAR replace[256];
+ GetDlgItemText(hwndDlg, IDC_NEW, replace, SIZEOF(replace));
+ lstrtrim(replace);
+
+ if (!data->findReadOnly && find[0] == 0) {
+ MessageBox(hwndDlg, TranslateT("The wrong word can't be empty!"), TranslateT("Wrong Correction"),
+ MB_OK | MB_ICONERROR);
+ }
+ else if (replace[0] == 0) {
+ MessageBox(hwndDlg, TranslateT("The correction can't be empty!"), TranslateT("Wrong Correction"),
+ MB_OK | MB_ICONERROR);
}
- case IDC_VARIABLES:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_VAR_HELP), IsDlgButtonChecked(hwndDlg, IDC_VARIABLES));
- break;
+ else if (_tcscmp(find, replace) == 0) {
+ MessageBox(hwndDlg, TranslateT("The correction can't be equal to the wrong word!"), TranslateT("Wrong Correction"),
+ MB_OK | MB_ICONERROR);
}
- case IDC_VAR_HELP:
- {
- variables_showhelp(hwndDlg, IDC_NEW, VHF_FULLDLG, NULL, "The wrong word typed by the user");
- break;
+ else {
+ data->callback(FALSE, data->dict,
+ find, replace, IsDlgButtonChecked(hwndDlg, IDC_VARIABLES),
+ data->find.c_str(), data->param);
+ Close(hwndDlg, 1);
}
}
break;
- case WM_CLOSE:
- {
+ case IDCANCEL:
Close(hwndDlg, 0);
break;
+
+ case IDC_VARIABLES:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VAR_HELP), IsDlgButtonChecked(hwndDlg, IDC_VARIABLES));
+ break;
+
+ case IDC_VAR_HELP:
+ variables_showhelp(hwndDlg, IDC_NEW, VHF_FULLDLG, NULL, "The wrong word typed by the user");
+ break;
}
+ break;
+
+ case WM_CLOSE:
+ Close(hwndDlg, 0);
+ break;
}
return FALSE;
diff --git a/plugins/SpellChecker/src/commons.h b/plugins/SpellChecker/src/commons.h index 834c2ad21e..41d9e6e2e8 100644 --- a/plugins/SpellChecker/src/commons.h +++ b/plugins/SpellChecker/src/commons.h @@ -64,7 +64,6 @@ using namespace std; #include "../utils/mir_memory.h"
#include "../utils/mir_options.h"
-#include "../utils/mir_icons.h"
#include "../utils/tstring.h"
#include "../utils/utf8_helpers.h"
#include "../utils/scope.h"
@@ -137,8 +136,6 @@ struct Dialog vector<WrongWordPopupMenuData> *wrong_words;
};
-HICON IcoLib_LoadIcon(Dictionary *dict, BOOL copy = FALSE);
-
BOOL CenterParent(HWND hwnd);
BOOL CreatePath(const TCHAR *path);
TCHAR *lstrtrim(TCHAR *str);
diff --git a/plugins/SpellChecker/src/dictionary.h b/plugins/SpellChecker/src/dictionary.h index b57aa730bd..3add2d739c 100644 --- a/plugins/SpellChecker/src/dictionary.h +++ b/plugins/SpellChecker/src/dictionary.h @@ -38,6 +38,7 @@ public: TCHAR full_name[256];
TCHAR source[128];
AutoReplaceMap *autoReplace;
+ HANDLE hIcolib;
virtual ~Dictionary() {}
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 09157e2cb3..7b462e072e 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -163,9 +163,8 @@ static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict) rc.left = lpdis->rcItem.left + 2;
// Draw icon
- if (opts.use_flags)
- {
- HICON hFlag = IcoLib_LoadIcon(dict);
+ if (opts.use_flags) {
+ HICON hFlag = Skin_GetIcon( _T2A(dict->language));
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2;
DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL);
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 25980828c0..e428349c3e 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -33,21 +33,8 @@ PLUGININFOEX pluginInfo={ __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 } } // {36753AE3-840B-4797-94A5-FD9F5852B942} -}; - -typedef struct -{ - TCHAR* szDescr; - char* szName; - int defIconID; -} IconStruct; - -static IconStruct iconList[] = -{ - { LPGENT("Enabled"), "spellchecker_enabled", IDI_CHECK }, - { LPGENT("Disabled"), "spellchecker_disabled", IDI_NO_CHECK }, -// { LPGENT("Unknown Flag"), "spellchecker_unknown_flag", IDI_UNKNOWN_FLAG }, + // {36753AE3-840B-4797-94A5-FD9F5852B942} + { 0x36753ae3, 0x840b, 0x4797, { 0x94, 0xa5, 0xfd, 0x9f, 0x58, 0x52, 0xb9, 0x42 } } }; #define TIMER_ID 17982 @@ -60,9 +47,6 @@ HINSTANCE hInst; int hLangpack = 0; -HANDLE hHooks[6]; -HANDLE hServices[3]; - HANDLE hDictionariesFolder = NULL; TCHAR *dictionariesFolder; @@ -122,17 +106,6 @@ DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98, // Functions //////////////////////////////////////////////////////////////////////////// - -HICON IcoLib_LoadIcon(Dictionary *dict, BOOL copy) -{ - - char lang[32]; - WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); - return IcoLib_LoadIcon(lang, copy); - -} - - extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; @@ -146,14 +119,44 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SPELLCHECKER, MIID_LAST }; -extern "C" int __declspec(dllexport) Load(void) +/////////////////////////////////////////////////////////////////////////////////////// + +struct +{ + char* szDescr; + char* szName; + int defIconID; + HANDLE hIcolib; +} +static iconList[] = { + { LPGEN("Enabled"), "spellchecker_enabled", IDI_CHECK }, + { LPGEN("Disabled"), "spellchecker_disabled", IDI_NO_CHECK } +}; +extern "C" int __declspec(dllexport) Load(void) +{ mir_getLP(&pluginInfo); + // icons + TCHAR path[MAX_PATH]; + GetModuleFileName(hInst, path, MAX_PATH); + + SKINICONDESC sid = { sizeof(sid) }; + sid.flags = SIDF_PATH_TCHAR; + sid.pszSection = LPGEN("Spell Checker"); + sid.ptszDefaultFile = path; + + for (int i = 0; i < SIZEOF(iconList); ++i) { + sid.pszDescription = iconList[i].szDescr; + sid.pszName = iconList[i].szName; + sid.iDefaultIndex = -iconList[i].defIconID; + iconList[i].hIcolib = Skin_AddIcon(&sid); + } + // hooks - hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); hCheckedBmp = LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)); if (GetObject(hCheckedBmp, sizeof(bmpChecked), &bmpChecked) == 0) @@ -179,8 +182,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); // Folders plugin support - if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) - { + if ( ServiceExists(MS_FOLDERS_REGISTER_PATH)) { hDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER); dictionariesFolder = (TCHAR *) mir_alloc(sizeof(TCHAR) * MAX_PATH); @@ -196,84 +198,59 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) flagsDllFolder = (TCHAR *) mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hFlagsDllFolder, flagsDllFolder, MAX_PATH, _T(".")); } - else - { + else { dictionariesFolder = Utils_ReplaceVarsT(DICTIONARIES_FOLDER); customDictionariesFolder = Utils_ReplaceVarsT(CUSTOM_DICTIONARIES_FOLDER); flagsDllFolder = Utils_ReplaceVarsT(FLAGS_DLL_FOLDER); } - TCHAR path[MAX_PATH]; - GetModuleFileName(hInst, path, MAX_PATH); - - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); - sid.flags = SIDF_ALL_TCHAR; - sid.ptszSection = LPGENT("Spell Checker"); - sid.ptszDefaultFile = path; - - for (unsigned i = 0; i < SIZEOF(iconList); ++i) - { - sid.ptszDescription = iconList[i].szDescr; - sid.pszName = iconList[i].szName; - sid.iDefaultIndex = -iconList[i].defIconID; - Skin_AddIcon(&sid); - } - InitOptions(); GetAvaibleDictionaries(languages, dictionariesFolder, customDictionariesFolder); LoadOptions(); - if (opts.use_flags) - { + if (opts.use_flags) { // Load flags dll - TCHAR flag_file[1024]; + TCHAR flag_file[MAX_PATH]; mir_sntprintf(flag_file, SIZEOF(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder); HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE); + TCHAR path[MAX_PATH]; + GetModuleFileName(hInst, path, MAX_PATH); + + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_ALL_TCHAR | SIDF_SORTED; - sid.ptszSection = _T("Languages/Flags"); + sid.ptszSection = _T("Spellchecker/Flags"); // Get language flags - for(int i = 0; i < languages.getCount(); i++) - { - sid.ptszDescription = languages[i]->full_name; + for(int i = 0; i < languages.getCount(); i++) { + Dictionary *p = languages[i]; + sid.ptszDescription = p->full_name; char lang[32]; - mir_snprintf(lang, SIZEOF(lang), "%S", languages[i]->language); + mir_snprintf(lang, SIZEOF(lang), "spell_lang_%d", i); sid.pszName = lang; - - HICON hFlag = IcoLib_LoadIcon(sid.pszName); - if (hFlag != NULL) - { - // Already registered - Skin_ReleaseIcon(hFlag); - continue; - } - + HICON hFlag; if (hFlagsDll != NULL) - hFlag = (HICON) LoadImage(hFlagsDll, languages[i]->language, IMAGE_ICON, 16, 16, 0); + hFlag = (HICON)LoadImage(hFlagsDll, p->language, IMAGE_ICON, 16, 16, 0); else hFlag = NULL; - if (hFlag != NULL) - { + if (hFlag != NULL) { sid.hDefaultIcon = hFlag; sid.ptszDefaultFile = NULL; sid.iDefaultIndex = 0; } - else - { + else { sid.hDefaultIcon = NULL; sid.ptszDefaultFile = path; sid.iDefaultIndex = - IDI_UNKNOWN_FLAG; } // Oki, lets add to IcoLib, then - Skin_AddIcon(&sid); + p->hIcolib = Skin_AddIcon(&sid); if (hFlag != NULL) DestroyIcon(hFlag); @@ -281,8 +258,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) FreeLibrary(hFlagsDll); } - for (int j = 0; j < languages.getCount(); j++) - { + for (int j = 0; j < languages.getCount(); j++) { Dictionary *dict = languages[j]; TCHAR filename[MAX_PATH]; @@ -293,25 +269,22 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) dict->load(); } - hHooks[2] = HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged); - hHooks[3] = HookEvent(ME_MSG_WINDOWEVENT, &MsgWindowEvent); - hHooks[4] = HookEvent(ME_MSG_WINDOWPOPUP, &MsgWindowPopup); - hHooks[5] = HookEvent(ME_MSG_ICONPRESSED, &IconPressed); + HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged); + HookEvent(ME_MSG_WINDOWEVENT, &MsgWindowEvent); + HookEvent(ME_MSG_WINDOWPOPUP, &MsgWindowPopup); + HookEvent(ME_MSG_ICONPRESSED, &IconPressed); - hServices[0] = CreateServiceFunction(MS_SPELLCHECKER_ADD_RICHEDIT, AddContactTextBoxService); - hServices[1] = CreateServiceFunction(MS_SPELLCHECKER_REMOVE_RICHEDIT, RemoveContactTextBoxService); - hServices[2] = CreateServiceFunction(MS_SPELLCHECKER_SHOW_POPUP_MENU, ShowPopupMenuService); + CreateServiceFunction(MS_SPELLCHECKER_ADD_RICHEDIT, AddContactTextBoxService); + CreateServiceFunction(MS_SPELLCHECKER_REMOVE_RICHEDIT, RemoveContactTextBoxService); + CreateServiceFunction(MS_SPELLCHECKER_SHOW_POPUP_MENU, ShowPopupMenuService); - if (ServiceExists(MS_MSG_ADDICON)) - { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); + if (ServiceExists(MS_MSG_ADDICON)) { + StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; - sid.hIconDisabled = IcoLib_LoadIcon("spellchecker_disabled", TRUE); + sid.hIconDisabled = Skin_GetIcon("spellchecker_disabled"); sid.flags = MBF_HIDDEN; - for (int i = 0; i < languages.getCount(); i++) - { + for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; char tmp[128]; @@ -319,10 +292,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) Translate("Spell Checker"), languages[i]->full_name); sid.szTooltip = tmp; - if (opts.use_flags) - sid.hIcon = IcoLib_LoadIcon(languages[i], TRUE); - else - sid.hIcon = IcoLib_LoadIcon("spellchecker_enabled", TRUE); + HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); + sid.hIcon = CopyIcon(hIcon); + Skin_ReleaseIcon(hIcon); CallService(MS_MSG_ADDICON, 0, (LPARAM) &sid); } @@ -345,17 +317,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) int IconsChanged(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_MSG_MODIFYICON)) - { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); + if ( ServiceExists(MS_MSG_MODIFYICON)) { + StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; - sid.hIconDisabled = IcoLib_LoadIcon("spellchecker_disabled", TRUE); + sid.hIconDisabled = Skin_GetIcon("spellchecker_disabled"); sid.flags = MBF_HIDDEN; - - for (int i = 0; i < languages.getCount(); i++) - { + for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; char tmp[128]; @@ -363,10 +331,9 @@ int IconsChanged(WPARAM wParam, LPARAM lParam) Translate("Spell Checker"), languages[i]->full_name); sid.szTooltip = tmp; - if (opts.use_flags) - sid.hIcon = IcoLib_LoadIcon(languages[i], TRUE); - else - sid.hIcon = IcoLib_LoadIcon("spellchecker_enabled", TRUE); + HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); + sid.hIcon = CopyIcon(hIcon); + Skin_ReleaseIcon(hIcon); CallService(MS_MSG_MODIFYICON, 0, (LPARAM) &sid); } @@ -378,19 +345,10 @@ int IconsChanged(WPARAM wParam, LPARAM lParam) int PreShutdown(WPARAM wParam, LPARAM lParam) { - int i; - for(i = 0; i < SIZEOF(hServices); i++) - DestroyServiceFunction(hServices[i]); - - for(i = 0; i < SIZEOF(hHooks); i++) - UnhookEvent(hHooks[i]); - DeInitOptions(); - if (ServiceExists(MS_MSG_REMOVEICON)) - { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); + if (ServiceExists(MS_MSG_REMOVEICON)) { + StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; CallService(MS_MSG_REMOVEICON, 0, (LPARAM) &sid); } @@ -398,7 +356,6 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) mir_free(dictionariesFolder); mir_free(customDictionariesFolder); mir_free(flagsDllFolder); - return 0; } @@ -1657,7 +1614,7 @@ void AddMenuForWord(Dialog *dlg, TCHAR *word, CHARRANGE &pos, HMENU hMenu, BOOL if (suggestions.count > 0) { InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0); - for (int i = suggestions.count - 1; i >= 0; i--) + for (int i = suggestions.count-1; i >= 0; i--) InsertMenu(data.hReplaceSubMenu, 0, MF_BYPOSITION, base + AUTOREPLACE_MENU_ID_BASE + i, suggestions.words[i]); } @@ -2130,14 +2087,16 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) rc.left += bmpChecked.bmWidth + 2; // Draw icon - HICON hFlag = IcoLib_LoadIcon(dict); + if (dict->hIcolib) { + HICON hFlag = Skin_GetIconByHandle(dict->hIcolib); - rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2; - DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL); + rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2; + DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL); - Skin_ReleaseIcon(hFlag); + Skin_ReleaseIcon(hFlag); - rc.left += ICON_SIZE + 4; + rc.left += ICON_SIZE + 4; + } // Draw text RECT rc_text = { 0, 0, 0xFFFF, 0xFFFF }; |