From e3cefc7b6ca803e3f87dbadae54a110332778490 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 5 Jul 2012 22:41:06 +0000 Subject: - first of the /Core standard plugins; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@778 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/skin/hotkey_opts.cpp | 14 +++++++------- src/modules/skin/hotkeys.cpp | 30 +++++++++++++++--------------- src/modules/skin/skinicons.cpp | 36 ++++++++++++++++++------------------ src/modules/skin/sounds.cpp | 10 +++++----- 4 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/modules/skin') diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index 6bebcdc273..f23e777604 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -331,7 +331,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) DBWriteContactSettingByte(NULL, DBMODULENAME "Types", item->pszName, (BYTE)item->type); item->nSubHotkeys = 0; - for (i = 0; i < hotkeys.getCount(); i++) { + for (i=0; i < hotkeys.getCount(); i++) { THotkeyItem *subItem = hotkeys[i]; if (subItem->rootHotkey == item) { subItem->Hotkey = subItem->OptHotkey; @@ -351,10 +351,10 @@ static void sttOptionsSaveItem(THotkeyItem *item) static void sttBuildHotkeyList(HWND hwndList) { - int i, nItems=0; + int i, nItems = 0; ListView_DeleteAllItems(hwndList); - for (i = 0; i < hotkeys.getCount(); i++) { + for (i=0; i < hotkeys.getCount(); i++) { LVITEM lvi = {0}; THotkeyItem *item = hotkeys[i]; @@ -469,7 +469,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvc.cx = GetSystemMetrics(SM_CXSMICON); ListView_InsertColumn(hwndHotkey, COL_ADDREMOVE, &lvc); - for (int i = 0; i < hotkeys.getCount(); i++) { + for (int i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; item->OptChanged = FALSE; @@ -728,7 +728,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, UnregisterHotkeys(); - for (i = 0; i < hotkeys.getCount(); i++) { + for (i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; if (item->OptNew && item->OptDeleted || item->rootHotkey && !item->OptHotkey || @@ -744,7 +744,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LVITEM lvi = {0}; int count = ListView_GetItemCount(hwndHotkey); - for (i = 0; i < hotkeys.getCount(); i++) + for (i=0; i < hotkeys.getCount(); i++) sttOptionsSaveItem(hotkeys[i]); lvi.mask = LVIF_IMAGE; @@ -886,7 +886,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, else if (param->uNewState>>12 == 2) { int i, nItems = ListView_GetItemCount(lpnmhdr->hwndFrom); initialized = FALSE; - for (i = 0; i < hotkeys.getCount(); ++i) { + for (i=0; i < hotkeys.getCount(); ++i) { LVITEM lvi = {0}; THotkeyItem *item = hotkeys[i]; diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index bf939d5716..05297f92b3 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -51,7 +51,7 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam); WORD GetHotkeyValue(INT_PTR idHotkey) { - for (int i = 0; i < hotkeys.getCount(); i++) + for (int i=0; i < hotkeys.getCount(); i++) if (hotkeys[i]->idHotkey == idHotkey) return hotkeys[i]->Enabled ? hotkeys[i]->Hotkey : 0; @@ -71,7 +71,7 @@ static void sttWordToModAndVk(WORD w, BYTE *mod, BYTE *vk) static LRESULT CALLBACK sttHotkeyHostWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_HOTKEY) { - for (int i = 0; i < hotkeys.getCount(); i++) { + for (int i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; if (item->type != HKT_GLOBAL || !item->Enabled) continue; @@ -91,7 +91,7 @@ static LRESULT CALLBACK sttHotkeyHostWndProc(HWND hwnd, UINT msg, WPARAM wParam, static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) { if (code == HC_ACTION && !(HIWORD(lParam) & KF_UP)) { - BYTE mod=0, vk=wParam; + BYTE mod = 0, vk = wParam; if (vk) { if (GetAsyncKeyState(VK_CONTROL)) mod |= MOD_CONTROL; @@ -99,7 +99,7 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) if (GetAsyncKeyState(VK_SHIFT)) mod |= MOD_SHIFT; if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) mod |= MOD_WIN; - for (int i = 0; i < hotkeys.getCount(); i++) { + for (int i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; BYTE hkMod, hkVk; if (item->type != HKT_LOCAL) continue; @@ -194,7 +194,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) int count, i; mir_snprintf(buf, SIZEOF(buf), "%s$count", item->pszName); count = (int)DBGetContactSettingDword(NULL, DBMODULENAME, buf, -1); - for (i = 0; i < count; i++) { + for (i=0; i < count; i++) { mir_snprintf(buf, SIZEOF(buf), "%s$%d", item->pszName, i); if ( !DBGetContactSettingWord(NULL, DBMODULENAME, buf, 0)) continue; @@ -220,14 +220,14 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) mir_snprintf(pszNamePrefix, SIZEOF(pszNamePrefix), "%s$", pszName); cbNamePrefix = strlen(pszNamePrefix); - for (i = 0; i < hotkeys.getCount(); ++i) + for (i=0; i < hotkeys.getCount(); ++i) { char *pszCurrentName = hotkeys[i]->rootHotkey ? hotkeys[i]->rootHotkey->pszName : hotkeys[i]->pszName; if ( !pszCurrentName) continue; - hotkeys[i]->UnregisterHotkey = + hotkeys[i]->UnregisterHotkey = !lstrcmpA(pszCurrentName, pszName) || !strncmp(pszCurrentName, pszNamePrefix, cbNamePrefix); } @@ -235,7 +235,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) if (g_hwndHkOptions) SendMessage(g_hwndHkOptions, WM_HOTKEYUNREGISTERED, 0, 0); - for (i = 0; i < hotkeys.getCount(); ++i) + for (i=0; i < hotkeys.getCount(); ++i) if (hotkeys[i]->UnregisterHotkey) { FreeHotkey(hotkeys[i]); List_Remove((SortedList *)&hotkeys, i); @@ -252,7 +252,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) { int i; - BYTE mod=0, vk=msg->wParam; + BYTE mod = 0, vk = msg->wParam; if (vk) { if (GetAsyncKeyState(VK_CONTROL)) mod |= MOD_CONTROL; @@ -260,7 +260,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) if (GetAsyncKeyState(VK_SHIFT)) mod |= MOD_SHIFT; if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) mod |= MOD_WIN; - for (i = 0; i < hotkeys.getCount(); i++) { + for (i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; BYTE hkMod, hkVk; if ((item->type != HKT_MANUAL) || lstrcmp(pszSection, item->ptszSection)) continue; @@ -290,7 +290,7 @@ void FreeHotkey(THotkeyItem *item) void RegisterHotkeys() { - for (int i = 0; i < hotkeys.getCount(); i++) { + for (int i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey); if (item->type != HKT_GLOBAL) continue; @@ -302,7 +302,7 @@ void RegisterHotkeys() void KillModuleHotkeys(int hLangpack) { - for (int i=hotkeys.getCount()-1; i >= 0; i--) { + for (int i = hotkeys.getCount()-1; i >= 0; i--) { THotkeyItem *item = hotkeys[i]; if (item->hLangpack == hLangpack) { FreeHotkey(item); @@ -313,7 +313,7 @@ void KillModuleHotkeys(int hLangpack) void UnregisterHotkeys() { - for (int i = 0; i < hotkeys.getCount(); i++) { + for (int i=0; i < hotkeys.getCount(); i++) { THotkeyItem *item = hotkeys[i]; if (item->type == HKT_GLOBAL && item->Enabled) UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey); @@ -369,7 +369,7 @@ int LoadSkinHotkeys(void) HookEvent(ME_SYSTEM_MODULESLOADED, sttModulesLoaded); - for (int i = 0; i < SIZEOF(oldSettings); i++) { + for (int i=0; i < SIZEOF(oldSettings); i++) { char szSetting[ 100 ]; mir_snprintf(szSetting, SIZEOF(szSetting), "HK%s", oldSettings[i]); @@ -398,7 +398,7 @@ void UnloadSkinHotkeys(void) UnhookWindowsHookEx(hhkKeyboard); UnregisterHotkeys(); DestroyWindow(g_hwndHotkeyHost); - for (int i = 0; i < hotkeys.getCount(); i++) + for (int i=0; i < hotkeys.getCount(); i++) FreeHotkey(hotkeys[i]); hotkeys.destroy(); } diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 509135ae20..796b2033f4 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -32,7 +32,7 @@ struct StandardIconDescription const char* section; }; -static const struct StandardIconDescription mainIcons[] = +static const struct StandardIconDescription mainIcons[] = { { SKINICON_OTHER_MIRANDA, LPGEN("Miranda IM"), -IDI_MIRANDA }, { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, @@ -85,7 +85,7 @@ static const struct StandardIconDescription mainIcons[] = HANDLE hMainIcons[SIZEOF(mainIcons)]; -static const struct StandardIconDescription statusIcons[] = +static const struct StandardIconDescription statusIcons[] = { { ID_STATUS_OFFLINE, LPGEN("Offline"), -IDI_OFFLINE, 0xFFFFFFFF }, { ID_STATUS_ONLINE, LPGEN("Online"), -IDI_ONLINE, PF2_ONLINE }, @@ -101,9 +101,9 @@ static const struct StandardIconDescription statusIcons[] = HANDLE hStatusIcons[SIZEOF(statusIcons)]; -const char* mainIconsFmt = "core_main_"; +const char* mainIconsFmt = "core_main_"; const char* statusIconsFmt = "core_status_"; -const char* protoIconsFmt = LPGEN("%s Icons"); +const char* protoIconsFmt = LPGEN("%s Icons"); #define PROTOCOLS_PREFIX "Status Icons/" #define GLOBAL_PROTO_NAME "*" @@ -135,7 +135,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) { HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName); if ( !hResIcon) { //Icon not found in hInstance lets try to load it from core - HINSTANCE hCoreInstance=hInst; + HINSTANCE hCoreInstance = hInst; if (hCoreInstance != hInstance) hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName); } @@ -144,7 +144,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource) { - HICON hTempIcon=LoadIconEx(hInst, szResource, 0); + HICON hTempIcon = LoadIconEx(hInst, szResource, 0); int res = ImageList_AddIcon(hIml, hTempIcon); Safe_DestroyIcon(hTempIcon); return res; @@ -154,7 +154,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) { HICON hIcon = LoadSkinIcon(iconId); int res = ImageList_AddIcon(hIml, hIcon); - IconLib_ReleaseIcon(hIcon, 0); + IcoLib_ReleaseIcon(hIcon, 0); return res; } @@ -162,7 +162,7 @@ int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, i { HICON hIcon = LoadSkinProtoIcon(szProto, iconId); int res = ImageList_AddIcon(hIml, hIcon); - IconLib_ReleaseIcon(hIcon, 0); + IcoLib_ReleaseIcon(hIcon, 0); return res; } @@ -177,7 +177,7 @@ int ImageList_ReplaceIcon_NotShared(HIMAGELIST hIml, int iIndex, HINSTANCE hInst int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon) { int res = ImageList_ReplaceIcon(hIml, nIndex, hIcon); - IconLib_ReleaseIcon(hIcon, 0); + IcoLib_ReleaseIcon(hIcon, 0); return res; } @@ -195,8 +195,8 @@ void Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId) void Window_FreeIcon_IcoLib(HWND hWnd) { - IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL); - IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL); + IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL); + IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL); } void Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* tooltip) @@ -210,7 +210,7 @@ void Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* too void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId) { HICON hIcon = (HICON)SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0); - IconLib_ReleaseIcon(hIcon, 0); + IcoLib_ReleaseIcon(hIcon, 0); } // @@ -229,7 +229,7 @@ HICON LoadSkinProtoIcon(const char* szProto, int status, bool big) return IcoLib_GetIcon(iconName, big); } - for (i = 0; i < SIZEOF(statusIcons); i++) { + for (i=0; i < SIZEOF(statusIcons); i++) { if (statusIcons[i].id == status) { statusIndx = i; break; @@ -335,7 +335,7 @@ HICON LoadSkinProtoIcon(const char* szProto, int status, bool big) HANDLE GetSkinIconHandle(int idx) { int i; - for (i = 0; i < SIZEOF(mainIcons); i++) + for (i=0; i < SIZEOF(mainIcons); i++) if (idx == mainIcons[i].id) return hMainIcons[i]; @@ -365,7 +365,7 @@ static void convertOneProtocol(char* moduleName, char* iconName) char* pm = moduleName + strlen(moduleName); char* pi = iconName + strlen(iconName); - for (int i = 0; i < SIZEOF(statusIcons); i++) { + for (int i=0; i < SIZEOF(statusIcons); i++) { _itoa(statusIcons[i].id, pm, 10); DBVARIANT dbv; @@ -416,7 +416,7 @@ int LoadSkinIcons(void) // // Perform "1st-time running import" - for (i = 0; i < SIZEOF(mainIcons); i++) { + for (i=0; i < SIZEOF(mainIcons); i++) { _itoa(mainIcons[i].id, moduleName, 10); if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv)) break; @@ -465,7 +465,7 @@ int LoadSkinIcons(void) // // Add main icons to list // - for (i = 0; i < SIZEOF(mainIcons); i++) { + for (i=0; i < SIZEOF(mainIcons); i++) { mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i); sid.pszSection = mainIcons[i].section == NULL ? "Main Icons" : (char*)mainIcons[i].section; sid.pszDescription = (char*)mainIcons[i].description; @@ -479,7 +479,7 @@ int LoadSkinIcons(void) // // Asterisk is used, to avoid conflict with proto-plugins // 'coz users can't rename it to name with '*' - for (i = 0; i < SIZEOF(statusIcons); i++) { + for (i=0; i < SIZEOF(statusIcons); i++) { mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i); sid.pszName = iconName; sid.pszDescription = (char*)statusIcons[i].description; diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index 05422ffef6..448ff26358 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -53,7 +53,7 @@ static OBJLIST arSounds(10, CompareSounds); void KillModuleSounds(int hLangpack) { - for (int i=arSounds.getCount()-1; i >= 0; i--) { + for (int i = arSounds.getCount()-1; i >= 0; i--) { SoundItem& p = arSounds[i]; if (p.hLangpack == hLangpack) { p.clear(); @@ -192,7 +192,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (tvi.lParam == -1) TreeView_SetItemState(hwndTree, tvi.hItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK); - tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem); + tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); } } ShowWindow(hwndTree, SW_SHOW); @@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, strFull); } if (LOWORD(wParam) == IDC_GETMORE) { - CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=5"); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://addons.miranda-im.org/index.php?action = display&id = 5"); break; } if (LOWORD(wParam) == IDC_LOCATION) @@ -355,7 +355,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvic.hItem = TreeView_GetNextSibling(hwndTree, tvic.hItem); } } - tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem); + tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); } return TRUE; } @@ -419,7 +419,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE; } -static UINT iconsExpertOnlyControls[]={IDC_IMPORT}; +static UINT iconsExpertOnlyControls[] = {IDC_IMPORT}; static int SkinOptionsInit(WPARAM wParam, LPARAM) { -- cgit v1.2.3