diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
commit | 3f23417a1099f73dc28ec1b7d6ec2a1a7fc2b7a2 (patch) | |
tree | 3e0bcd88c55dad310da0dc980e252bf9fbfa6dc5 /src/modules/skin | |
parent | 537b94169bf2483798a651ee3b96f7904eebe7b4 (diff) |
- PLUGININFO structure removed at all;
- Options_AddPage & UserInfo_AddPage replaced MS_OPT_ADDPAGE & MS_USERINFO_ADDPAGE services respectively
- total internal redesign of options' translation
- code reformatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/skin')
-rw-r--r-- | src/modules/skin/hotkeys.cpp | 164 | ||||
-rw-r--r-- | src/modules/skin/skinicons.cpp | 224 | ||||
-rw-r--r-- | src/modules/skin/sounds.cpp | 94 |
3 files changed, 241 insertions, 241 deletions
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 64987b4aa4..e9588c30ad 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -55,18 +55,18 @@ struct _THotkeyItem static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2)
{
int res;
- if ( res = lstrcmp( p1->ptszSection_tr, p2->ptszSection_tr ))
+ if (res = lstrcmp(p1->ptszSection_tr, p2->ptszSection_tr))
return res;
- if ( res = lstrcmp( p1->ptszDescription_tr, p2->ptszDescription_tr ))
+ if (res = lstrcmp(p1->ptszDescription_tr, p2->ptszDescription_tr))
return res;
- if (!p1->rootHotkey && p2->rootHotkey)
+ if ( !p1->rootHotkey && p2->rootHotkey)
return -1;
if (p1->rootHotkey && !p2->rootHotkey)
return 1;
return 0;
}
-static LIST<THotkeyItem> hotkeys( 10, sttCompareHotkeys );
+static LIST<THotkeyItem> hotkeys(10, sttCompareHotkeys);
static void sttFreeHotkey(THotkeyItem *item);
@@ -107,12 +107,12 @@ 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 ) {
+ if (msg == WM_HOTKEY) {
int i;
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
if (item->type != HKT_GLOBAL) continue;
- if (!item->Enabled) continue;
+ if ( !item->Enabled) continue;
if (item->pszService && (wParam == item->idHotkey)) {
CallService(item->pszService, 0, item->lParam);
break;
@@ -130,19 +130,19 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) int i;
BYTE mod=0, vk=wParam;
- if ( vk ) {
+ if (vk) {
if (GetAsyncKeyState(VK_CONTROL)) mod |= MOD_CONTROL;
if (GetAsyncKeyState(VK_MENU)) mod |= MOD_ALT;
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_LOCAL) continue;
sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk);
- if (!hkVk) continue;
- if (!item->Enabled) continue;
+ if ( !hkVk) continue;
+ if ( !item->Enabled) continue;
if (item->pszService && (vk == hkVk) && (mod == hkMod)) {
CallService(item->pszService, 0, item->lParam);
return TRUE;
@@ -166,18 +166,18 @@ static INT_PTR svcHotkeyUnsubclass(WPARAM wParam, LPARAM) static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam)
{
HOTKEYDESC *desc = (HOTKEYDESC *)lParam;
- if ( desc->cbSize != sizeof(HOTKEYDESC) && desc->cbSize != HOTKEYDESC_SIZE_V1 )
+ if (desc->cbSize != sizeof(HOTKEYDESC) && desc->cbSize != HOTKEYDESC_SIZE_V1)
return 0;
- THotkeyItem *item = ( THotkeyItem* )mir_alloc(sizeof(THotkeyItem));
- DWORD dwFlags = ( desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
- if ( dwFlags & HKD_UNICODE ) {
- item->ptszSection = mir_tstrdup( desc->ptszSection );
- item->ptszDescription = mir_tstrdup( desc->ptszDescription );
+ THotkeyItem *item = (THotkeyItem*)mir_alloc(sizeof(THotkeyItem));
+ DWORD dwFlags = (desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
+ if (dwFlags & HKD_UNICODE) {
+ item->ptszSection = mir_tstrdup(desc->ptszSection);
+ item->ptszDescription = mir_tstrdup(desc->ptszDescription);
}
else {
- item->ptszSection = mir_a2u( desc->pszSection );
- item->ptszDescription = mir_a2u( desc->pszDescription );
+ item->ptszSection = mir_a2u(desc->pszSection);
+ item->ptszDescription = mir_a2u(desc->pszDescription);
}
item->ptszSection_tr = TranslateTS(item->ptszSection);
@@ -186,7 +186,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->rootHotkey = NULL;
item->nSubHotkeys = 0;
- if ( item->rootHotkey = hotkeys.find( item )) {
+ if (item->rootHotkey = hotkeys.find(item)) {
if (item->rootHotkey->allowSubHotkeys) {
char nameBuf[MAXMODULELABELLENGTH];
mir_snprintf(nameBuf, SIZEOF(nameBuf), "%s$%d", item->rootHotkey->pszName, item->rootHotkey->nSubHotkeys);
@@ -211,7 +211,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->DefHotkey = desc->DefHotKey & ~HKF_MIRANDA_LOCAL;
item->Hotkey = DBGetContactSettingWord(NULL, DBMODULENAME, item->pszName, item->DefHotkey);
item->type = item->pszService ?
- ( THotkeyType )DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName,
+ (THotkeyType)DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName,
(desc->DefHotKey & HKF_MIRANDA_LOCAL) ? HKT_LOCAL : HKT_GLOBAL) : HKT_MANUAL;
item->lParam = desc->lParam;
@@ -225,16 +225,16 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) if (vk) RegisterHotKey(g_hwndHotkeyHost, item->idHotkey, mod, vk);
} }
- hotkeys.insert( item );
+ hotkeys.insert(item);
- if ( !item->rootHotkey ) {
+ if ( !item->rootHotkey) {
/* try to load alternatives from db */
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++) {
mir_snprintf(buf, SIZEOF(buf), "%s$%d", item->pszName, i);
- if (!DBGetContactSettingWord(NULL, DBMODULENAME, buf, 0))
+ if ( !DBGetContactSettingWord(NULL, DBMODULENAME, buf, 0))
continue;
svcHotkeyRegister(wParam, lParam);
@@ -242,7 +242,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->allowSubHotkeys = count < 0;
}
else {
- mir_free( item->pszName );
+ mir_free(item->pszName);
item->pszName = NULL;
}
@@ -263,10 +263,10 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char *pszCurrentName = hotkeys[i]->rootHotkey ?
hotkeys[i]->rootHotkey->pszName :
hotkeys[i]->pszName;
- if (!pszCurrentName) continue;
+ if ( !pszCurrentName) continue;
hotkeys[i]->UnregisterHotkey =
- !lstrcmpA(pszCurrentName, pszName) ||
+ !lstrcmpA(pszCurrentName, pszName) ||
!strncmp(pszCurrentName, pszNamePrefix, cbNamePrefix);
}
@@ -298,13 +298,13 @@ 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;
sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk);
- if (!hkVk) continue;
- if (!item->Enabled) continue;
+ if ( !hkVk) continue;
+ if ( !item->Enabled) continue;
if ((vk == hkVk) && (mod == hkMod)) {
mir_free(pszSection);
return item->lParam;
@@ -316,7 +316,7 @@ static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam) static void sttFreeHotkey(THotkeyItem *item)
{
- if ( item->type == HKT_GLOBAL && item->Enabled )
+ if (item->type == HKT_GLOBAL && item->Enabled)
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
GlobalDeleteAtom(item->idHotkey);
mir_free(item->pszName);
@@ -329,7 +329,7 @@ static void sttFreeHotkey(THotkeyItem *item) static void sttRegisterHotkeys()
{
int i;
- for ( i = 0; i < hotkeys.getCount(); i++ ) {
+ for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
if (item->type != HKT_GLOBAL) continue;
@@ -344,7 +344,7 @@ static void sttUnregisterHotkeys() int i;
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
- if ( item->type == HKT_GLOBAL && item->Enabled )
+ if (item->type == HKT_GLOBAL && item->Enabled)
UnregisterHotKey(g_hwndHotkeyHost, item->idHotkey);
}
}
@@ -420,7 +420,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP {
THotkeyBoxData *data = (THotkeyBoxData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
BOOL bKeyDown = FALSE;
- if (!data) return 0;
+ if ( !data) return 0;
switch (msg) {
case HKM_GETHOTKEY:
@@ -460,7 +460,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP BYTE shift = 0;
BYTE key = wParam;
TCHAR *name = sttHokeyVkToName(key);
- if (!*name || !bKeyDown) key = 0;
+ if ( !*name || !bKeyDown) key = 0;
if (GetAsyncKeyState(VK_CONTROL)) shift |= HOTKEYF_CONTROL;
if (GetAsyncKeyState(VK_MENU)) shift |= HOTKEYF_ALT;
@@ -518,7 +518,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) LVITEM lvi = {0};
lvi.iItem = idx;
- if ( !item->rootHotkey ) {
+ if ( !item->rootHotkey) {
lvi.mask = LVIF_TEXT|LVIF_IMAGE;
lvi.iSubItem = COL_NAME;
lvi.pszText = item->ptszDescription_tr;
@@ -534,7 +534,7 @@ static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item) lvi.pszText = buf;
ListView_SetItem(hwndList, &lvi);
- if ( item->rootHotkey ) {
+ if (item->rootHotkey) {
lvi.mask = LVIF_IMAGE;
lvi.iSubItem = COL_TYPE;
lvi.iImage = item->OptType;
@@ -588,16 +588,16 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP if (ListView_GetItem((HWND)lParamSort, &lvi))
item2 = (THotkeyItem *)lvi.lParam;
- if (!item1 && !item2)
+ if ( !item1 && !item2)
return lstrcmp(title1, title2);
- if (!item1) {
+ if ( !item1) {
if (res = lstrcmp(title1, item2->ptszSection_tr))
return res;
return -1;
}
- if (!item2) {
+ if ( !item2) {
if (res = lstrcmp(item1->ptszSection_tr, title2))
return res;
return 1;
@@ -627,7 +627,7 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) newItem->OptChanged = newItem->OptDeleted = FALSE;
newItem->OptNew = TRUE;
- hotkeys.insert( newItem );
+ hotkeys.insert(newItem);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
@@ -655,7 +655,7 @@ static void sttOptionsSaveItem(THotkeyItem *item) char buf[MAXMODULELABELLENGTH];
if (item->rootHotkey) return;
- if (!item->OptChanged) return;
+ if ( !item->OptChanged) return;
item->Hotkey = item->OptHotkey;
item->type = item->OptType;
@@ -697,7 +697,7 @@ static void sttBuildHotkeyList(HWND hwndList, TCHAR *section) if (item->OptDeleted) continue;
if (section && lstrcmp(section, item->ptszSection)) continue;
- if ( !section && (!i || lstrcmp(item->ptszSection, ((THotkeyItem *)hotkeys[i-1])->ptszSection ))) {
+ if ( !section && ( !i || lstrcmp(item->ptszSection, ((THotkeyItem *)hotkeys[i-1])->ptszSection))) {
lvi.mask = LVIF_TEXT|LVIF_PARAM;
lvi.iItem = nItems++;
lvi.iSubItem = 0;
@@ -715,7 +715,7 @@ static void sttBuildHotkeyList(HWND hwndList, TCHAR *section) }
lvi.mask = LVIF_PARAM;
- if (!section) {
+ if ( !section) {
lvi.mask |= LVIF_INDENT;
lvi.iIndent = 1;
}
@@ -901,7 +901,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int count;
LVITEM lvi = {0};
- if (!initialized) break;
+ if ( !initialized) break;
newLanguage = LOWORD(GetKeyboardLayout(0));
if (newLanguage == currentLanguage) break;
@@ -910,7 +910,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
ListView_GetItem(hwndHotkey, &lvi);
- if (!lvi.lParam) continue;
+ if ( !lvi.lParam) continue;
sttOptionsSetupItem(hwndHotkey, lvi.iItem, (THotkeyItem *)lvi.lParam);
}
@@ -928,7 +928,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) {
ListView_GetItem(hwndHotkey, &lvi);
- if (!lvi.lParam) continue;
+ if ( !lvi.lParam) continue;
if (((THotkeyItem *)lvi.lParam)->UnregisterHotkey) {
ListView_DeleteItem(hwndHotkey, lvi.iItem);
@@ -996,14 +996,14 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
case WM_COMMAND:
- if (( LOWORD( wParam ) == IDC_HOTKEY) && (( HIWORD( wParam ) == EN_KILLFOCUS) || (HIWORD(wParam) == 0 ))) {
+ if ((LOWORD(wParam) == IDC_HOTKEY) && ((HIWORD(wParam) == EN_KILLFOCUS) || (HIWORD(wParam) == 0))) {
LVITEM lvi;
THotkeyItem *item;
WORD wHotkey = (WORD)SendDlgItemMessage(hwndDlg, IDC_HOTKEY, HKM_GETHOTKEY, 0, 0);
ShowWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), SW_HIDE);
SetFocus(hwndHotkey);
- if ( !wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0 ))
+ if ( !wHotkey || (wHotkey == VK_ESCAPE) || (HIWORD(wParam) != 0))
break;
lvi.mask = LVIF_PARAM;
@@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (GetWindowLongPtr((HWND)wParam, GWL_ID) == IDC_LV_HOTKEYS)
{
HWND hwndList = (HWND)wParam;
- POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) };
+ POINT pt = { (signed short)LOWORD(lParam), (signed short)HIWORD(lParam) };
LVITEM lvi = {0};
THotkeyItem *item = NULL;
@@ -1032,9 +1032,9 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask = LVIF_PARAM;
ListView_GetItem(hwndList, &lvi);
- if (!(item = (THotkeyItem *)lvi.lParam)) return FALSE;
+ if ( !(item = (THotkeyItem *)lvi.lParam)) return FALSE;
- if (( pt.x == -1 ) && ( pt.y == -1 )) {
+ if ((pt.x == -1) && (pt.y == -1)) {
RECT rc;
ListView_GetItemRect(hwndList, lvi.iItem, &rc, LVIR_LABEL);
pt.x = rc.left;
@@ -1063,7 +1063,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, (UINT_PTR)MI_LOCAL, TranslateT("Miranda scope"));
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
- if (!item->rootHotkey)
+ if ( !item->rootHotkey)
AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_ADD, TranslateT("Add binding"));
else
AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_REMOVE, TranslateT("Remove"));
@@ -1101,7 +1101,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttOptionsSetupItem(hwndList, lvi.iItem, item);
break;
}
- DestroyMenu( hMenu );
+ DestroyMenu(hMenu);
}
break;
@@ -1116,20 +1116,20 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
int i;
- if (( lpnmhdr->code != PSN_APPLY) && (lpnmhdr->code != PSN_RESET ))
+ if ((lpnmhdr->code != PSN_APPLY) && (lpnmhdr->code != PSN_RESET))
break;
sttUnregisterHotkeys();
for (i = 0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
- if (item->OptNew && item->OptDeleted ||
- item->rootHotkey && !item->OptHotkey ||
- (lpnmhdr->code == PSN_APPLY) && item->OptDeleted ||
+ if (item->OptNew && item->OptDeleted ||
+ item->rootHotkey && !item->OptHotkey ||
+ (lpnmhdr->code == PSN_APPLY) && item->OptDeleted ||
(lpnmhdr->code == PSN_RESET) && item->OptNew)
{
sttFreeHotkey(item);
- hotkeys.remove( i-- );
+ hotkeys.remove(i--);
}
}
@@ -1149,7 +1149,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttRegisterHotkeys();
- NotifyEventHooks( hEvChanged, 0, 0 );
+ NotifyEventHooks(hEvChanged, 0, 0);
break;
}
case IDC_LV_HOTKEYS:
@@ -1172,7 +1172,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_HitTest(lpnmia->hdr.hwndFrom, &lvhti);
if (item &&
- (!item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) ||
+ ( !item->rootHotkey && (lpnmia->iSubItem == COL_NAME) && ((lvhti.flags & LVHT_ONITEM) == LVHT_ONITEMICON) ||
item->rootHotkey && (lpnmia->iSubItem == COL_TYPE)) &&
((item->OptType == HKT_GLOBAL) || (item->OptType == HKT_LOCAL)))
{
@@ -1200,7 +1200,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case LVN_KEYDOWN:
{
LPNMLVKEYDOWN param = (LPNMLVKEYDOWN)lParam;
- if ((param->wVKey == VK_SUBTRACT) || (param->wVKey == VK_LEFT) ||
+ if ((param->wVKey == VK_SUBTRACT) || (param->wVKey == VK_LEFT) ||
(param->wVKey == VK_ADD) || (param->wVKey == VK_RIGHT))
{
LVITEM lvi = {0};
@@ -1242,7 +1242,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
LPNMLISTVIEW param = (LPNMLISTVIEW)lParam;
THotkeyItem *item = (THotkeyItem *)param->lParam;
- if (!initialized || (param->uNewState>>12 == param->uOldState>>12))
+ if ( !initialized || (param->uNewState>>12 == param->uOldState>>12))
break;
if (item && !item->rootHotkey) {
@@ -1250,7 +1250,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, sttOptionsSetChanged(item);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- else if (!item) {
+ else if ( !item) {
TCHAR buf[256];
LVITEM lvi = {0};
lvi.mask = LVIF_TEXT;
@@ -1267,8 +1267,8 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, THotkeyItem *item;
ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
- if (!item) continue;
- if (!lstrcmp(item->ptszSection_tr, buf)) {
+ if ( !item) continue;
+ if ( !lstrcmp(item->ptszSection_tr, buf)) {
ListView_DeleteItem(lpnmhdr->hwndFrom, lvi.iItem);
--lvi.iItem;
--count;
@@ -1303,7 +1303,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (param->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
case CDDS_ITEMPREPAINT:
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
return TRUE;
case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
@@ -1318,7 +1318,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetItem(lpnmhdr->hwndFrom, &lvi);
item = (THotkeyItem *)lvi.lParam;
- if (!item) {
+ if ( !item) {
RECT rc;
HFONT hfnt;
@@ -1333,12 +1333,12 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_GetCheckState(hwndHotkey, lvi.iItem) ? 6 : 7,
param->nmcd.hdc, rc.left, (rc.top+rc.bottom-16)/2, ILD_TRANSPARENT);
rc.left += 18;
- hfnt = ( HFONT )SelectObject(param->nmcd.hdc, (HFONT)SendMessage(GetParent(hwndDlg), PSM_GETBOLDFONT, 0, 0));
+ hfnt = (HFONT)SelectObject(param->nmcd.hdc, (HFONT)SendMessage(GetParent(hwndDlg), PSM_GETBOLDFONT, 0, 0));
DrawText(param->nmcd.hdc, buf, -1, &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
SelectObject(param->nmcd.hdc, hfnt);
}
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
@@ -1346,7 +1346,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, RECT rc;
ListView_GetSubItemRect(lpnmhdr->hwndFrom, param->nmcd.dwItemSpec, param->iSubItem, LVIR_BOUNDS, &rc);
FillRect(param->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
break;
@@ -1373,7 +1373,7 @@ static int sttOptionsInit(WPARAM wParam, LPARAM) odp.ptszTitle = TranslateT("Hotkeys");
odp.ptszGroup = TranslateT("Customize");
odp.pfnDlgProc = sttOptionsDlgProc;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -1428,18 +1428,18 @@ int LoadSkinHotkeys(void) {
WORD key;
int i;
- for ( i = 0; i < SIZEOF( oldSettings ); i++ ) {
+ for (i = 0; i < SIZEOF(oldSettings); i++) {
char szSetting[ 100 ];
- mir_snprintf( szSetting, SIZEOF(szSetting), "HK%s", oldSettings[i] );
- if (( key = DBGetContactSettingWord( NULL, "Clist", szSetting, 0 ))) {
- DBDeleteContactSetting( NULL, "Clist", szSetting );
- DBWriteContactSettingWord( NULL, DBMODULENAME, newSettings[i], key );
+ mir_snprintf(szSetting, SIZEOF(szSetting), "HK%s", oldSettings[i]);
+ if ((key = DBGetContactSettingWord(NULL, "Clist", szSetting, 0))) {
+ DBDeleteContactSetting(NULL, "Clist", szSetting);
+ DBWriteContactSettingWord(NULL, DBMODULENAME, newSettings[i], key);
}
- mir_snprintf( szSetting, SIZEOF(szSetting), "HKEn%s", oldSettings[i] );
- if (( key = DBGetContactSettingByte( NULL, "Clist", szSetting, 0 ))) {
- DBDeleteContactSetting( NULL, "Clist", szSetting );
- DBWriteContactSettingByte( NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0) );
+ mir_snprintf(szSetting, SIZEOF(szSetting), "HKEn%s", oldSettings[i]);
+ if ((key = DBGetContactSettingByte(NULL, "Clist", szSetting, 0))) {
+ DBDeleteContactSetting(NULL, "Clist", szSetting);
+ DBWriteContactSettingByte(NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0));
} } }
return 0;
@@ -1449,13 +1449,13 @@ void UnloadSkinHotkeys(void) {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
DestroyHookableEvent(hEvChanged);
UnhookWindowsHookEx(hhkKeyboard);
sttUnregisterHotkeys();
DestroyWindow(g_hwndHotkeyHost);
- for ( i = 0; i < hotkeys.getCount(); i++ )
+ for (i = 0; i < hotkeys.getCount(); i++)
sttFreeHotkey(hotkeys[i]);
hotkeys.destroy();
}
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index a291309d93..787d22eca9 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -116,17 +116,17 @@ const char* protoIconsFmt = LPGEN("%s Icons"); static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName)
{
int cx = GetSystemMetrics(SM_CXSMICON);
- return ( HICON )LoadImage( hInstance, lpIconName, IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED );
+ return (HICON)LoadImage(hInstance, lpIconName, IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED);
}
// load small icon (not shared) it IS NEED to be destroyed
static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
{
HICON hIcon = NULL; // icon handle
- int index = -( int )lpIconName;
+ int index = -(int)lpIconName;
TCHAR filename[MAX_PATH] = {0};
- GetModuleFileName( hInstance, filename, MAX_PATH );
- ExtractIconEx( filename, index, NULL, &hIcon, 1 );
+ GetModuleFileName(hInstance, filename, MAX_PATH);
+ ExtractIconEx(filename, index, NULL, &hIcon, 1);
return hIcon;
}
@@ -134,9 +134,9 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) 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
+ if ( !hResIcon) { //Icon not found in hInstance lets try to load it from core
HINSTANCE hCoreInstance=hMirandaInst;
- if ( hCoreInstance != hInstance )
+ if (hCoreInstance != hInstance)
hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName);
}
return hResIcon;
@@ -144,7 +144,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource)
{
- HICON hTempIcon=LoadIconEx( hMirandaInst, szResource, 0);
+ HICON hTempIcon=LoadIconEx(hMirandaInst, szResource, 0);
int res = ImageList_AddIcon(hIml, hTempIcon);
Safe_DestroyIcon(hTempIcon);
return res;
@@ -152,7 +152,7 @@ int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource) int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId)
{
- HICON hIcon = LoadSkinIcon( iconId );
+ HICON hIcon = LoadSkinIcon(iconId);
int res = ImageList_AddIcon(hIml, hIcon);
IconLib_ReleaseIcon(hIcon, 0);
return res;
@@ -160,7 +160,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, int iconId)
{
- HICON hIcon = LoadSkinProtoIcon( szProto, iconId );
+ HICON hIcon = LoadSkinProtoIcon(szProto, iconId);
int res = ImageList_AddIcon(hIml, hIcon);
IconLib_ReleaseIcon(hIcon, 0);
return res;
@@ -183,33 +183,33 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon void Window_SetIcon_IcoLib(HWND hWnd, int iconId)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadSkinIcon( iconId, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadSkinIcon( iconId ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinIcon(iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinIcon(iconId));
}
void Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadSkinProtoIcon( szProto, iconId, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadSkinProtoIcon( szProto, iconId ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinProtoIcon(szProto, iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinProtoIcon(szProto, 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);
+ IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL);
+ IconLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL);
}
void Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* tooltip)
{
- HWND hWnd = GetDlgItem( hwndDlg, itemId );
- SendMessage( hWnd, BM_SETIMAGE, IMAGE_ICON, ( LPARAM )LoadSkinIcon( iconId ));
- SendMessage( hWnd, BUTTONSETASFLATBTN, 0, 0 );
- SendMessage( hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0);
+ HWND hWnd = GetDlgItem(hwndDlg, itemId);
+ SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinIcon(iconId));
+ SendMessage(hWnd, BUTTONSETASFLATBTN, 0, 0);
+ SendMessage(hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0);
}
void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId)
{
- HICON hIcon = ( HICON )SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0 );
+ HICON hIcon = (HICON)SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0);
IconLib_ReleaseIcon(hIcon, 0);
}
@@ -217,52 +217,52 @@ void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId) // wParam = szProto
// lParam = status
//
-HICON LoadSkinProtoIcon( const char* szProto, int status, bool big )
+HICON LoadSkinProtoIcon(const char* szProto, int status, bool big)
{
int i, statusIndx = -1;
char iconName[MAX_PATH];
HICON hIcon;
- DWORD caps2 = ( szProto == NULL ) ? ( DWORD )-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
+ DWORD caps2 = (szProto == NULL) ? (DWORD)-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
- if ( status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7 );
- return IcoLib_GetIcon( iconName, big );
+ if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7);
+ return IcoLib_GetIcon(iconName, big);
}
- for ( i = 0; i < SIZEOF(statusIcons); i++ ) {
- if ( statusIcons[i].id == status ) {
+ for (i = 0; i < SIZEOF(statusIcons); i++) {
+ if (statusIcons[i].id == status) {
statusIndx = i;
break;
} }
- if ( statusIndx == -1 )
+ if (statusIndx == -1)
return NULL;
- if ( !szProto ) {
+ if ( !szProto) {
// Only return a protocol specific icon if there is only one protocol
// Otherwise return the global icon. This affects the global status menu mainly.
- if ( accounts.getCount() == 1 ) {
+ if (accounts.getCount() == 1) {
HICON hIcon;
// format: core_status_%proto%statusindex
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon )
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon)
return hIcon;
}
// format: core_status_%s%d
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
- return IcoLib_GetIcon( iconName, big );
+ return IcoLib_GetIcon(iconName, big);
}
// format: core_status_%s%d
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon == NULL && ( caps2 == 0 || ( caps2 & statusIcons[statusIndx].pf2 ))) {
- PROTOACCOUNT* pa = Proto_GetAccount( szProto );
- if ( pa ) {
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
+ PROTOACCOUNT* pa = Proto_GetAccount(szProto);
+ if (pa) {
TCHAR szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
SKINICONDESC sid = { 0 };
@@ -270,29 +270,29 @@ HICON LoadSkinProtoIcon( const char* szProto, int status, bool big ) // Queried protocol isn't in list, adding
//
TCHAR tszSection[MAX_PATH];
- mir_sntprintf( tszSection, SIZEOF(tszSection), _T("%s%s"), _T(PROTOCOLS_PREFIX), pa->tszAccountName );
+ mir_sntprintf(tszSection, SIZEOF(tszSection), _T("%s%s"), _T(PROTOCOLS_PREFIX), pa->tszAccountName);
sid.ptszSection = tszSection;
sid.cbSize = sizeof(sid);
sid.flags = SIDF_ALL_TCHAR;
- GetModuleFileName( hMirandaInst, szPath, MAX_PATH );
- str = _tcsrchr( szPath, '\\' );
- if ( str != NULL )
+ GetModuleFileName(hMirandaInst, szPath, MAX_PATH);
+ str = _tcsrchr(szPath, '\\');
+ if (str != NULL)
*str = 0;
- mir_sntprintf( szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, pa->szProtoName );
- if ( GetFileAttributes( szFullPath ) != INVALID_FILE_ATTRIBUTES )
+ mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, pa->szProtoName);
+ if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.ptszDefaultFile = szFullPath;
else {
- mir_sntprintf( szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, szProto );
- if (( int )ExtractIconEx( szFullPath, statusIcons[i].resource_id, NULL, &hIcon, 1 ) > 0 ) {
- DestroyIcon( hIcon );
+ mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\") _T(TCHAR_STR_PARAM) _T(".dll"), szPath, szProto);
+ if ((int)ExtractIconEx(szFullPath, statusIcons[i].resource_id, NULL, &hIcon, 1) > 0) {
+ DestroyIcon(hIcon);
sid.ptszDefaultFile = szFullPath;
hIcon = NULL;
}
- if ( sid.pszDefaultFile == NULL ) {
- if ( str != NULL )
+ if (sid.pszDefaultFile == NULL) {
+ if (str != NULL)
*str = '\\';
sid.ptszDefaultFile = szPath;
} }
@@ -302,108 +302,108 @@ HICON LoadSkinProtoIcon( const char* szProto, int status, bool big ) //
{
int lowidx, highidx;
- if ( caps2 == 0 )
+ if (caps2 == 0)
lowidx = statusIndx, highidx = statusIndx+1;
else
lowidx = 0, highidx = SIZEOF(statusIcons);
- for ( i = lowidx; i < highidx; i++ ) {
- if ( caps2 == 0 || ( caps2 & statusIcons[i].pf2 )) {
+ for (i = lowidx; i < highidx; i++) {
+ if (caps2 == 0 || (caps2 & statusIcons[i].pf2)) {
// format: core_%s%d
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i);
sid.pszName = iconName;
- sid.ptszDescription = cli.pfnGetStatusModeDescription( statusIcons[i].id, 0 );
+ sid.ptszDescription = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
sid.iDefaultIndex = statusIcons[i].resource_id;
- IcoLib_AddNewIcon( &sid );
+ IcoLib_AddNewIcon(&sid);
} } } }
// format: core_status_%s%d
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx );
- hIcon = IcoLib_GetIcon( iconName, big );
- if ( hIcon )
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, statusIndx);
+ hIcon = IcoLib_GetIcon(iconName, big);
+ if (hIcon)
return hIcon;
}
- if ( hIcon == NULL ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx );
- hIcon = IcoLib_GetIcon( iconName, big );
+ if (hIcon == NULL) {
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
+ hIcon = IcoLib_GetIcon(iconName, big);
}
return hIcon;
}
-HANDLE GetSkinIconHandle( int idx )
+HANDLE GetSkinIconHandle(int idx)
{
int i;
- for ( i = 0; i < SIZEOF(mainIcons); i++ )
- if ( idx == mainIcons[i].id )
+ for (i = 0; i < SIZEOF(mainIcons); i++)
+ if (idx == mainIcons[i].id)
return hMainIcons[i];
return NULL;
}
-HICON LoadSkinIcon( int idx, bool big )
+HICON LoadSkinIcon(int idx, bool big)
{
//
// Query for global status icons
//
- if ( idx < SKINICON_EVENT_MESSAGE ) {
- if ( idx >= SIZEOF( statusIcons ))
+ if (idx < SKINICON_EVENT_MESSAGE) {
+ if (idx >= SIZEOF(statusIcons))
return NULL;
- return LoadSkinProtoIcon( NULL, statusIcons[ idx ].id, big );
+ return LoadSkinProtoIcon(NULL, statusIcons[ idx ].id, big);
}
- return IcoLib_GetIconByHandle( GetSkinIconHandle( idx ), big );
+ return IcoLib_GetIconByHandle(GetSkinIconHandle(idx), big);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Initializes the icon skin module
-static void convertOneProtocol( char* moduleName, char* iconName )
+static void convertOneProtocol(char* moduleName, char* iconName)
{
- char* pm = moduleName + strlen( moduleName );
- char* pi = iconName + strlen( iconName );
+ char* pm = moduleName + strlen(moduleName);
+ char* pi = iconName + strlen(iconName);
DBVARIANT dbv;
int i;
- for ( i = 0; i < SIZEOF(statusIcons); i++ ) {
- _itoa( statusIcons[i].id, pm, 10 );
+ for (i = 0; i < SIZEOF(statusIcons); i++) {
+ _itoa(statusIcons[i].id, pm, 10);
- if ( !DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ) ) {
- _itoa( i, pi, 10 );
+ if ( !DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv)) {
+ _itoa(i, pi, 10);
- DBWriteContactSettingTString( NULL, "SkinIcons", iconName, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ DBWriteContactSettingTString(NULL, "SkinIcons", iconName, dbv.ptszVal);
+ DBFreeVariant(&dbv);
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
} } }
-static INT_PTR sttLoadSkinIcon( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinIcon(WPARAM wParam, LPARAM lParam)
{
switch (lParam)
{
case 0:
- return (INT_PTR)LoadSkinIcon( wParam );
+ return (INT_PTR)LoadSkinIcon(wParam);
case 1:
- return (INT_PTR)GetSkinIconHandle( wParam );
+ return (INT_PTR)GetSkinIconHandle(wParam);
case 2:
- return (INT_PTR)LoadSkinIcon( wParam, true );
+ return (INT_PTR)LoadSkinIcon(wParam, true);
}
return 0;
}
-static INT_PTR sttLoadSkinProtoIcon( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinProtoIcon(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false);
}
-static INT_PTR sttLoadSkinProtoIconBig( WPARAM wParam, LPARAM lParam )
+static INT_PTR sttLoadSkinProtoIconBig(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true);
}
int LoadSkinIcons(void)
@@ -417,46 +417,46 @@ int LoadSkinIcons(void) //
// Perform "1st-time running import"
- for ( i = 0; i < SIZEOF(mainIcons); i++ ) {
- _itoa( mainIcons[i].id, moduleName, 10 );
- if ( DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ))
+ for (i = 0; i < SIZEOF(mainIcons); i++) {
+ _itoa(mainIcons[i].id, moduleName, 10);
+ if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
break;
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
- DBWriteContactSettingTString( NULL, "SkinIcons", iconName, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ DBWriteContactSettingTString(NULL, "SkinIcons", iconName, dbv.ptszVal);
+ DBFreeVariant(&dbv);
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
}
- for (;; ) {
+ for (;;) {
// get the next protocol name
moduleName[0] = 'p';
moduleName[1] = 0;
- _itoa( j++, moduleName+1, 100 );
- if ( DBGetContactSettingTString( NULL, "Icons", moduleName, &dbv ))
+ _itoa(j++, moduleName+1, 100);
+ if (DBGetContactSettingTString(NULL, "Icons", moduleName, &dbv))
break;
- DBDeleteContactSetting( NULL, "Icons", moduleName );
+ DBDeleteContactSetting(NULL, "Icons", moduleName);
// make old skinicons' prefix
- mir_snprintf( moduleName, SIZEOF(moduleName), TCHAR_STR_PARAM, dbv.ptszVal );
+ mir_snprintf(moduleName, SIZEOF(moduleName), TCHAR_STR_PARAM, dbv.ptszVal);
// make IcoLib's prefix
- mir_snprintf( iconName, SIZEOF(iconName), "%s" TCHAR_STR_PARAM, statusIconsFmt, dbv.ptszVal );
+ mir_snprintf(iconName, SIZEOF(iconName), "%s" TCHAR_STR_PARAM, statusIconsFmt, dbv.ptszVal);
- convertOneProtocol( moduleName, iconName );
- DBFreeVariant( &dbv );
+ convertOneProtocol(moduleName, iconName);
+ DBFreeVariant(&dbv);
}
moduleName[0] = 0;
strcpy(iconName, "core_status_" GLOBAL_PROTO_NAME);
- convertOneProtocol( moduleName, iconName );
+ convertOneProtocol(moduleName, iconName);
- CreateServiceFunction( MS_SKIN_LOADICON, sttLoadSkinIcon );
- CreateServiceFunction( MS_SKIN_LOADPROTOICON, sttLoadSkinProtoIcon );
- CreateServiceFunction( MS_SKIN_LOADPROTOICONBIG, sttLoadSkinProtoIconBig );
+ CreateServiceFunction(MS_SKIN_LOADICON, sttLoadSkinIcon);
+ CreateServiceFunction(MS_SKIN_LOADPROTOICON, sttLoadSkinProtoIcon);
+ CreateServiceFunction(MS_SKIN_LOADPROTOICONBIG, sttLoadSkinProtoIconBig);
- ZeroMemory( &sid, sizeof(sid) );
+ ZeroMemory(&sid, sizeof(sid));
sid.cbSize = sizeof(sid);
GetModuleFileName(NULL, modulePath, SIZEOF(modulePath));
sid.ptszDefaultFile = modulePath;
@@ -466,12 +466,12 @@ int LoadSkinIcons(void) //
// Add main icons to list
//
- for ( i = 0; i < SIZEOF(mainIcons); i++ ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 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;
sid.iDefaultIndex = mainIcons[i].resource_id;
- hMainIcons[i] = IcoLib_AddNewIcon( &sid );
+ hMainIcons[i] = IcoLib_AddNewIcon(&sid);
}
//
// Add global icons to list
@@ -480,12 +480,12 @@ 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++ ) {
- mir_snprintf( iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, 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;
sid.iDefaultIndex = statusIcons[i].resource_id;
- hStatusIcons[i] = IcoLib_AddNewIcon( &sid );
+ hStatusIcons[i] = IcoLib_AddNewIcon(&sid);
}
return 0;
}
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index fad684a80a..4bd66ff50b 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -36,9 +36,9 @@ static HANDLE hPlayEvent = NULL; static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam)
{
- SKINSOUNDDESCEX *ssd = ( SKINSOUNDDESCEX* )lParam;
- switch( ssd->cbSize ) {
- case sizeof( SKINSOUNDDESCEX ):
+ SKINSOUNDDESCEX *ssd = (SKINSOUNDDESCEX*)lParam;
+ switch(ssd->cbSize) {
+ case sizeof(SKINSOUNDDESCEX):
case SKINSOUNDDESC_SIZE_V1:
case SKINSOUNDDESC_SIZE_V2:
break;
@@ -47,35 +47,35 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) return 1;
}
- if ( ssd->pszName == NULL || ssd->pszDescription == NULL)
+ if (ssd->pszName == NULL || ssd->pszDescription == NULL)
return 1;
DBVARIANT dbv;
- DWORD dwFlags = ( ssd->cbSize == sizeof(SKINSOUNDDESCEX)) ? ssd->dwFlags : 0;
+ DWORD dwFlags = (ssd->cbSize == sizeof(SKINSOUNDDESCEX)) ? ssd->dwFlags : 0;
soundList=(struct SoundItem*)mir_realloc(soundList, sizeof(struct SoundItem)*(soundCount+1));
SoundItem* item = &soundList[soundCount++];
- item->name = mir_strdup( ssd->pszName );
+ item->name = mir_strdup(ssd->pszName);
item->tempFile = NULL;
TCHAR* ptszDefaultFile;
- if ( dwFlags & SSDF_UNICODE ) {
- item->description = mir_tstrdup( TranslateTS( ssd->ptszDescription ));
- item->section = mir_tstrdup( TranslateTS( ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->ptszSection : _T("Other")));
- ptszDefaultFile = mir_tstrdup( ssd->ptszDefaultFile );
+ if (dwFlags & SSDF_UNICODE) {
+ item->description = mir_tstrdup(TranslateTS(ssd->ptszDescription));
+ item->section = mir_tstrdup(TranslateTS(ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->ptszSection : _T("Other")));
+ ptszDefaultFile = mir_tstrdup(ssd->ptszDefaultFile);
}
else {
- item->description = LangPackPcharToTchar( ssd->pszDescription );
- item->section = LangPackPcharToTchar( ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->pszSection : "Other" );
- ptszDefaultFile = mir_a2t( ssd->pszDefaultFile );
+ item->description = LangPackPcharToTchar(ssd->pszDescription);
+ item->section = LangPackPcharToTchar(ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->pszSection : "Other");
+ ptszDefaultFile = mir_a2t(ssd->pszDefaultFile);
}
- if ( ptszDefaultFile ) {
- if ( DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
+ if (ptszDefaultFile) {
+ if (DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
DBWriteContactSettingTString(NULL, "SkinSounds", item->name, ptszDefaultFile);
else
DBFreeVariant(&dbv);
- mir_free( ptszDefaultFile );
+ mir_free(ptszDefaultFile);
}
return 0;
@@ -84,7 +84,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
char * pszFile = (char *) lParam;
- if ( pszFile && (DBGetContactSettingByte(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
+ if (pszFile && (DBGetContactSettingByte(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
PlaySoundA(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
return 0;
@@ -92,11 +92,11 @@ static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam) static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam)
{
- char* pszSoundName = ( char* )lParam;
+ char* pszSoundName = (char*)lParam;
int j;
for (j=0; j<soundCount; j++) {
- if ( pszSoundName && strcmp( soundList[j].name, pszSoundName ) == 0) {
+ if (pszSoundName && strcmp(soundList[j].name, pszSoundName) == 0) {
if (DBGetContactSettingByte(NULL, "SkinSoundsOff", pszSoundName, 0) == 0) {
DBVARIANT dbv;
@@ -123,12 +123,12 @@ static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name) tvi.pszText = str;
tvi.cchTextMax = SIZEOF(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
- TreeView_GetItem( hwndTree, &tvi );
- if ( !_tcsicmp( str, name ))
+ while (tvi.hItem != NULL) {
+ TreeView_GetItem(hwndTree, &tvi);
+ if ( !_tcsicmp(str, name))
return tvi.hItem;
- tvi.hItem = TreeView_GetNextSibling( hwndTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
return NULL;
}
@@ -166,30 +166,30 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- for ( i=0; i < soundCount; i++ ) {
+ for (i=0; i < soundCount; i++) {
tvis.item.stateMask = TVIS_EXPANDED;
tvis.item.state = TVIS_EXPANDED;
- tvis.hParent = FindNamedTreeItemAtRoot( hwndTree, soundList[i].section );
- if ( tvis.hParent == NULL ) {
+ tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, soundList[i].section);
+ if (tvis.hParent == NULL) {
tvis.item.lParam = -1;
tvis.item.pszText = soundList[i].section;
- tvis.hParent = tvis.item.hItem = TreeView_InsertItem( hwndTree, &tvis );
+ tvis.hParent = tvis.item.hItem = TreeView_InsertItem(hwndTree, &tvis);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.state = INDEXTOSTATEIMAGEMASK(0);
- TreeView_SetItem( hwndTree, &tvis.item );
+ TreeView_SetItem(hwndTree, &tvis.item);
}
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(!DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[i].name, 0)?2:1);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK( !DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[i].name, 0)?2:1);
tvis.item.lParam = i;
tvis.item.pszText = soundList[i].description;
- TreeView_InsertItem( hwndTree, &tvis );
+ TreeView_InsertItem(hwndTree, &tvis);
} }
{ TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.lParam == -1 )
+ if (tvi.lParam == -1)
TreeView_SetItemState(hwndTree, tvi.hItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK);
tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -222,17 +222,17 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case DM_CHECKENABLED:
EnableWindow(GetDlgItem(hwndDlg, IDC_SOUNDTREE), IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
- if (!IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS))
+ if ( !IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS))
SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
else if (TreeView_GetSelection(hwndTree)&&TreeView_GetParent(hwndTree, TreeView_GetSelection(hwndTree)))
SendMessage(hwndDlg, DM_SHOWPANE, 0, 0);
break;
case WM_COMMAND:
- if ( LOWORD(wParam) == IDC_ENABLESOUNDS )
+ if (LOWORD(wParam) == IDC_ENABLESOUNDS)
SendMessage(hwndDlg, DM_CHECKENABLED, 0, 0);
- if ( LOWORD(wParam) == IDC_PREVIEW ) {
+ if (LOWORD(wParam) == IDC_PREVIEW) {
TVITEM tvi;
HTREEITEM hti;
@@ -248,7 +248,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)soundList[tvi.lParam].tempFile);
else {
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
char szPathFull[MAX_PATH];
pathToAbsolute(dbv.pszVal, szPathFull, NULL);
@@ -257,7 +257,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } }
break;
}
- if ( LOWORD( wParam ) == IDC_CHANGE ) {
+ if (LOWORD(wParam) == IDC_CHANGE) {
char str[MAX_PATH] = "", strFull[MAX_PATH], strdir[MAX_PATH]="", filter[MAX_PATH];
OPENFILENAMEA ofn;
TVITEM tvi;
@@ -301,7 +301,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "wav";
- if (!GetOpenFileNameA(&ofn)) break;
+ if ( !GetOpenFileNameA(&ofn)) break;
CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strFull);
soundList[tvi.lParam].tempFile = mir_strdup(strFull);
SetDlgItemTextA(hwndDlg, IDC_LOCATION, strFull);
@@ -323,21 +323,21 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int i;
DBWriteContactSettingByte(NULL, "Skin", "UseSound", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
- for ( i=0; i < soundCount; i++ )
- if ( soundList[i].tempFile )
+ for (i=0; i < soundCount; i++)
+ if (soundList[i].tempFile)
DBWriteContactSettingString(NULL, "SkinSounds", soundList[i].name, soundList[i].tempFile);
{
TVITEM tvi, tvic;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.lParam == -1 ) {
+ if (tvi.lParam == -1) {
tvic.hItem = TreeView_GetChild(hwndTree, tvi.hItem);
- while ( tvic.hItem != NULL ) {
+ while (tvic.hItem != NULL) {
tvic.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvic);
- if ((( tvic.state & TVIS_STATEIMAGEMASK ) >> 12 == 2 )) {
+ if (((tvic.state & TVIS_STATEIMAGEMASK) >> 12 == 2)) {
DBCONTACTGETSETTING cgs;
cgs.szModule = "SkinSoundsOff";
cgs.szSetting = soundList[tvic.lParam].name;
@@ -370,7 +370,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf);
if (soundList[tvi.lParam].tempFile)
SetDlgItemTextA(hwndDlg, IDC_LOCATION, soundList[tvi.lParam].tempFile);
- else if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
+ else if ( !DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_LOCATION, dbv.pszVal);
DBFreeVariant(&dbv);
}
@@ -420,7 +420,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Sounds");
odp.pfnDlgProc = DlgProcSoundOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -448,7 +448,7 @@ void UnloadSkinSounds(void) {
int i;
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
for (i=0;i<soundCount;i++) {
mir_free(soundList[i].name);
|