From 1f851a7e6842906722ab7b782b1dd53230abaf9b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 18 May 2015 23:07:03 +0000 Subject: minor cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@13690 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/findadd/searchresults.cpp | 136 +++++++++++----------- src/modules/fonts/FontOptions.cpp | 209 +++++++++++++++++----------------- src/modules/icolib/skin2opts.cpp | 113 +++++++++--------- 3 files changed, 222 insertions(+), 236 deletions(-) diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 75dd68cf5a..499756ec17 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -43,7 +43,7 @@ void SaveColumnSizes(HWND hwndResults) int columnCount = Header_GetItemCount(ListView_GetHeader(hwndResults)); if (columnCount != NUM_COLUMNID) return; ListView_GetColumnOrderArray(hwndResults, columnCount, columnOrder); - for (int i=0; i < NUM_COLUMNID; i++) { + for (int i = 0; i < NUM_COLUMNID; i++) { char szSetting[32]; mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i); db_set_b(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]); @@ -55,7 +55,7 @@ void SaveColumnSizes(HWND hwndResults) } static const TCHAR *szColumnNames[] = { NULL, NULL, _T("Nick"), _T("First Name"), _T("Last Name"), _T("E-mail") }; -static int defaultColumnSizes[] = {0, 90, 100, 100, 100, 2000}; +static int defaultColumnSizes[] = { 0, 90, 100, 100, 100, 2000 }; void LoadColumnSizes(HWND hwndResults, const char *szProto) { HDITEM hdi; @@ -69,24 +69,19 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) columnCount = NUM_COLUMNID; colOrdersValid = true; - for (int i=0; i < NUM_COLUMNID; i++) - { + for (int i = 0; i < NUM_COLUMNID; i++) { LVCOLUMN lvc; - if (i < columnCount) - { + if (i < columnCount) { int bNeedsFree = FALSE; lvc.mask = LVCF_TEXT | LVCF_WIDTH; if (szColumnNames[i] != NULL) lvc.pszText = TranslateTS(szColumnNames[i]); - else if (i == COLUMNID_HANDLE) - { - if (szProto) - { + else if (i == COLUMNID_HANDLE) { + if (szProto) { bNeedsFree = TRUE; - lvc.pszText = mir_a2t((char*)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0)); + lvc.pszText = mir_a2t((char*)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0)); } - else - lvc.pszText = _T("ID"); + else lvc.pszText = _T("ID"); } else lvc.mask &= ~LVCF_TEXT; mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i); @@ -98,7 +93,8 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) } mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i); columnOrder[i] = db_get_b(NULL, "FindAdd", szSetting, -1); - if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID) colOrdersValid = false; + if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID) + colOrdersValid = false; } if (colOrdersValid) @@ -124,22 +120,19 @@ static LPARAM ListView_GetItemLParam(HWND hwndList, int idx) int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - struct FindAddDlgData *dat = (struct FindAddDlgData*)GetWindowLongPtr((HWND) lParamSort, GWLP_USERDATA); - int sortMultiplier; - int sortCol; + struct FindAddDlgData *dat = (struct FindAddDlgData*)GetWindowLongPtr((HWND)lParamSort, GWLP_USERDATA); struct ListSearchResult *lsr1, *lsr2; - HWND hList = GetDlgItem((HWND) lParamSort, IDC_RESULTS); + HWND hList = GetDlgItem((HWND)lParamSort, IDC_RESULTS); - sortMultiplier = dat->bSortAscending?1:-1; - sortCol = dat->iLastColumnSortIndex; - if (!dat->bFlexSearchResult) - { + int sortMultiplier = dat->bSortAscending ? 1 : -1; + int sortCol = dat->iLastColumnSortIndex; + if (!dat->bFlexSearchResult) { lsr1 = (struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam1); lsr2 = (struct ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam2); - - if (lsr1 == NULL || lsr2 == NULL) return 0; - switch(sortCol) - { + if (lsr1 == NULL || lsr2 == NULL) + return 0; + + switch (sortCol) { case COLUMNID_PROTO: return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier; case COLUMNID_HANDLE: @@ -154,8 +147,7 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa return mir_tstrcmpi(lsr1->psr.email, lsr2->psr.email)*sortMultiplier; } } - else - { + else { TCHAR szText1[100]; TCHAR szText2[100]; ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, SIZEOF(szText1)); @@ -168,7 +160,7 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa void FreeSearchResults(HWND hwndResults) { LV_ITEM lvi; - for (lvi.iItem = ListView_GetItemCount(hwndResults)-1;lvi.iItem>=0;lvi.iItem--) { + for (lvi.iItem = ListView_GetItemCount(hwndResults) - 1; lvi.iItem >= 0; lvi.iItem--) { lvi.mask = LVIF_PARAM; ListView_GetItem(hwndResults, &lvi); struct ListSearchResult *lsr = (struct ListSearchResult*)lvi.lParam; @@ -205,12 +197,12 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha int failures = 0; dat->searchCount = 0; dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount()); - for (int i=0; i < accounts.getCount();i++) { + for (int i = 0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; if (!Proto_IsAccountEnabled(pa)) continue; - DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD caps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps&requiredCapability)) continue; - dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL,pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); + dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[dat->searchCount].szProto = pa->szModuleName; if (dat->search[dat->searchCount].hProcess == NULL) failures++; else dat->searchCount++; @@ -228,7 +220,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha else { dat->search = (struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo)); dat->searchCount = 1; - dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(NULL,szProto, szSearchService, 0, (LPARAM)pvSearchParams); + dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(NULL, szProto, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[0].szProto = szProto; if (dat->search[0].hProcess == NULL) { //infuriatingly vague error message. fixme. @@ -243,57 +235,58 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha return 0; } -// !!!!!!!! this code is dangerous like a hell void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat) { - TCHAR str[256]; + CMString str; if (dat->searchCount != 0) { - mir_tstrcpy(str, TranslateT("Searching")); - for (int i=0; i < dat->searchCount; i++) { + str = TranslateT("Searching"); + for (int i = 0; i < dat->searchCount; i++) { PROTOACCOUNT *pa = Proto_GetAccount(dat->search[i].szProto); if (!pa) continue; - mir_tstrcat(str, i ? _T(", ") : _T(" ")); - mir_tstrcat(str, pa->tszAccountName); + str.Append(i ? _T(", ") : _T(" ")); + str.Append(pa->tszAccountName); } } - else mir_tstrcpy(str, TranslateT("Idle")); + else str = TranslateT("Idle"); - SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)str); + SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)str.c_str()); } struct ProtoResultsSummary { const char *szProto; int count; }; + void SetStatusBarResultInfo(HWND hwndDlg) { HWND hwndResults = GetDlgItem(hwndDlg, IDC_RESULTS); - TCHAR str[256]; + CMString str; + int total = ListView_GetItemCount(hwndResults); if (total != 0) { LV_ITEM lvi; struct ProtoResultsSummary *subtotal = NULL; int subtotalCount = 0; - for (lvi.iItem = total-1;lvi.iItem>=0;lvi.iItem--) { + for (lvi.iItem = total - 1; lvi.iItem >= 0; lvi.iItem--) { lvi.mask = LVIF_PARAM; ListView_GetItem(hwndResults, &lvi); struct ListSearchResult *lsr = (struct ListSearchResult*)lvi.lParam; if (lsr == NULL) continue; + int i = 0; - while (iszProto) { subtotal[i].count++; break; } - else - i++; + i++; } if (i == subtotalCount) { - subtotal = (struct ProtoResultsSummary*)mir_realloc(subtotal, sizeof(struct ProtoResultsSummary)*(subtotalCount+1)); + subtotal = (struct ProtoResultsSummary*)mir_realloc(subtotal, sizeof(struct ProtoResultsSummary)*(subtotalCount + 1)); subtotal[subtotalCount].szProto = lsr->szProto; subtotal[subtotalCount++].count = 1; } @@ -305,30 +298,29 @@ void SetStatusBarResultInfo(HWND hwndDlg) return; } else if (total == 1) - mir_sntprintf(str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName); + str.AppendFormat(TranslateT("1 %s user found"), pa->tszAccountName); else - mir_sntprintf(str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName); + str.AppendFormat(TranslateT("%d %s users found"), total, pa->tszAccountName); } else { - mir_sntprintf(str, SIZEOF(str), TranslateT("%d users found ("), total); - for (int i=0; i < subtotalCount; i++) { + str.AppendFormat(TranslateT("%d users found ("), total); + for (int i = 0; i < subtotalCount; i++) { PROTOACCOUNT *pa = Proto_GetAccount(subtotal[i].szProto); if (pa == NULL) continue; - - if (i) - mir_tstrcat(str, _T(", ")); - - TCHAR substr[64]; - mir_sntprintf(substr, SIZEOF(substr), _T("%d %s"), subtotal[i].count, pa->tszAccountName); - mir_tstrcat(str, substr); + + if (i) + str.Append(_T(", ")); + + str.AppendFormat(_T("%d %s"), subtotal[i].count, pa->tszAccountName); } - mir_tstrcat(str, _T(")")); + str.AppendChar(')'); } mir_free(subtotal); } - else mir_tstrcpy(str, TranslateT("No users found")); - SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 2, (LPARAM)str); + else str = TranslateT("No users found"); + + SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 2, (LPARAM)str.c_str()); } void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto) @@ -344,38 +336,38 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) struct FindAddDlgData *dat = (struct FindAddDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); LVITEM lvi; - if (ListView_GetSelectedCount( GetDlgItem(hwndDlg, IDC_RESULTS)) != 1) return; + if (ListView_GetSelectedCount(GetDlgItem(hwndDlg, IDC_RESULTS)) != 1) return; lvi.mask = LVIF_PARAM; - lvi.iItem = ListView_GetNextItem( GetDlgItem(hwndDlg, IDC_RESULTS), -1, LVNI_ALL|LVNI_SELECTED); - ListView_GetItem( GetDlgItem(hwndDlg, IDC_RESULTS), &lvi); + lvi.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_RESULTS), -1, LVNI_ALL | LVNI_SELECTED); + ListView_GetItem(GetDlgItem(hwndDlg, IDC_RESULTS), &lvi); struct ListSearchResult *lsr = (struct ListSearchResult*)lvi.lParam; HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); HMENU hPopupMenu = GetSubMenu(hMenu, 4); TranslateMenu(hPopupMenu); - int commandId = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hwndDlg, NULL); - switch(commandId) { - case IDC_ADD: + int commandId = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hwndDlg, NULL); + switch (commandId) { + case IDC_ADD: { ADDCONTACTSTRUCT acs = { 0 }; acs.handleType = HANDLE_SEARCHRESULT; acs.szProto = lsr->szProto; acs.psr = &lsr->psr; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); - break; } - case IDC_DETAILS: + break; + case IDC_DETAILS: { MCONTACT hContact = (MCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); - break; } - case IDC_SENDMESSAGE: + break; + case IDC_SENDMESSAGE: { MCONTACT hContact = (MCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_MSG_SENDMESSAGE, hContact, 0); - break; } + break; } DestroyMenu(hPopupMenu); DestroyMenu(hMenu); diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 0a21cd878a..78a1b54776 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -38,7 +38,7 @@ static int sttCompareFont(const FontInternal* p1, const FontInternal* p2) if (result != 0) return result; - return _tcscmp( p1->getName(), p2->getName()); + return _tcscmp(p1->getName(), p2->getName()); } OBJLIST font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont); @@ -53,7 +53,7 @@ static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2) if (result != 0) return result; - return _tcscmp( p1->getName(), p2->getName()); + return _tcscmp(p1->getName(), p2->getName()); } OBJLIST colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour); @@ -68,7 +68,7 @@ static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2) if (result != 0) return result; - return _tcscmp( p1->getName(), p2->getName()); + return _tcscmp(p1->getName(), p2->getName()); } OBJLIST effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect); @@ -96,10 +96,10 @@ int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * l static BYTE bIfServiceExists = ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) ? 1 : 0; if (pEffect == NULL || pEffect->effectIndex == 0) - return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType + return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType if (bIfServiceExists == 0) - return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat); + return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); // else params.cbSize = sizeof(DrawTextWithEffectParam); @@ -144,7 +144,7 @@ static BOOL ExportSettings(HWND hwndDlg, const TCHAR *filename, OBJLISTfont_id >= 0) { FontInternal& F = font_id_list_w2[itemData->font_id]; @@ -299,7 +298,7 @@ static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name) { - TVITEM tvi = {0}; + TVITEM tvi = { 0 }; TCHAR str[MAX_PATH]; if (hItem) @@ -314,8 +313,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC tvi.pszText = str; tvi.cchTextMax = SIZEOF(str); - while (tvi.hItem) - { + while (tvi.hItem) { TreeView_GetItem(hwndTree, &tvi); if (!mir_tstrcmp(tvi.pszText, name)) @@ -350,14 +348,14 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { - TVINSERTSTRUCT tvis = {0}; + TVINSERTSTRUCT tvis = { 0 }; TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem)); treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName); treeItem->paramName = mir_t2a(itemName); tvis.hParent = hSection; tvis.hInsertAfter = TVI_SORT;//TVI_LAST; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; tvis.item.pszText = pItemName; tvis.item.lParam = (LPARAM)treeItem; @@ -365,7 +363,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, memset(&tvis.item, 0, sizeof(tvis.item)); tvis.item.hItem = hItem; - tvis.item.mask = TVIF_HANDLE|TVIF_STATE; + tvis.item.mask = TVIF_HANDLE | TVIF_STATE; tvis.item.state = tvis.item.stateMask = db_get_b(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED); TreeView_SetItem(hwndTree, &tvis.item); } @@ -434,11 +432,11 @@ static void sttFreeListItems(HWND hList) static void ShowEffectButton(HWND hwndDlg, BOOL bShow) { - ShowWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bShow ? SW_HIDE : SW_SHOW); - ShowWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOUR_STATIC), bShow ? SW_HIDE : SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bShow ? SW_HIDE : SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR_STATIC), bShow ? SW_HIDE : SW_SHOW); - ShowWindow( GetDlgItem(hwndDlg, IDC_EFFECT), bShow ? SW_SHOW : SW_HIDE); - ShowWindow( GetDlgItem(hwndDlg, IDC_EFFECT_STATIC), bShow ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_EFFECT), bShow ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_EFFECT_STATIC), bShow ? SW_SHOW : SW_HIDE); } TCHAR* ModernEffectNames[] = { LPGENT(""), LPGENT("Shadow at left"), LPGENT("Shadow at right"), LPGENT("Outline"), LPGENT("Outline smooth"), LPGENT("Smooth bump"), LPGENT("Contour thin"), LPGENT("Contour heavy") }; @@ -450,16 +448,16 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - pEffect = (FONTEFFECT*) lParam; + pEffect = (FONTEFFECT*)lParam; { - for (int i=0; i < SIZEOF(ModernEffectNames); i++) { + for (int i = 0; i < SIZEOF(ModernEffectNames); i++) { int itemid = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_ADDSTRING, 0, (LPARAM)TranslateTS(ModernEffectNames[i])); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0); } int cnt = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0); - for (int i=0; i < cnt; i++) { + for (int i = 0; i < cnt; i++) { if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex) { SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0); break; @@ -467,13 +465,13 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar } } - SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_SETCOLOUR, 0, pEffect->baseColour&0x00FFFFFF); - SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_SETCOLOUR, 0, pEffect->secondaryColour&0x00FFFFFF); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_SETCOLOUR, 0, pEffect->baseColour & 0x00FFFFFF); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_SETCOLOUR, 0, pEffect->secondaryColour & 0x00FFFFFF); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_SETRANGE, 0, MAKELONG(255, 0)); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_SETRANGE, 0, MAKELONG(255, 0)); - SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->baseColour&0xFF000000)>>24)), 0)); - SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->secondaryColour&0xFF000000)>>24)), 0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->baseColour & 0xFF000000) >> 24)), 0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->secondaryColour & 0xFF000000) >> 24)), 0)); return TRUE; case WM_COMMAND: @@ -482,8 +480,8 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar { int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0); pEffect->effectIndex = (BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0); - pEffect->baseColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0))<<24); - pEffect->secondaryColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0))<<24); + pEffect->baseColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0) | ((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0)) << 24); + pEffect->secondaryColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0) | ((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0)) << 24); } EndDialog(hwndDlg, IDOK); return TRUE; @@ -571,27 +569,27 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, effect_id_list_w2 = effect_id_list; effect_id_list_w3 = effect_id_list; - for (i=0; i < font_id_list_w2.getCount(); i++) { + for (i = 0; i < font_id_list_w2.getCount(); i++) { FontInternal& F = font_id_list_w2[i]; // sync settings with database UpdateFontSettings(&F, &F.value); - sttFsuiCreateSettingsTreeNode( GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group, F.hLangpack); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group, F.hLangpack); } - for (i=0; i < colour_id_list_w2.getCount(); i++) { + for (i = 0; i < colour_id_list_w2.getCount(); i++) { ColourInternal& C = colour_id_list_w2[i]; // sync settings with database UpdateColourSettings(&C, &C.value); - sttFsuiCreateSettingsTreeNode( GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group, C.hLangpack); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group, C.hLangpack); } - for (i=0; i < effect_id_list_w2.getCount(); i++) { + for (i = 0; i < effect_id_list_w2.getCount(); i++) { EffectInternal& E = effect_id_list_w2[i]; // sync settings with database UpdateEffectSettings(&E, &E.value); - sttFsuiCreateSettingsTreeNode( GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group, E.hLangpack); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group, E.hLangpack); } SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, (LPARAM)GetSysColor(COLOR_WINDOW)); @@ -600,14 +598,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case UM_SETFONTGROUP: TreeItem *treeItem; { - TVITEM tvi = {0}; - tvi.hItem = TreeView_GetSelection( GetDlgItem(hwndDlg, IDC_FONTGROUP)); - tvi.mask = TVIF_HANDLE|TVIF_PARAM; - TreeView_GetItem( GetDlgItem(hwndDlg, IDC_FONTGROUP), &tvi); + TVITEM tvi = { 0 }; + tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_FONTGROUP)); + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_FONTGROUP), &tvi); treeItem = (TreeItem *)tvi.lParam; TCHAR *group_buff = treeItem->groupName; - sttFreeListItems( GetDlgItem(hwndDlg, IDC_FONTLIST)); + sttFreeListItems(GetDlgItem(hwndDlg, IDC_FONTLIST)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_RESETCONTENT, 0, 0); if (group_buff) { @@ -635,7 +633,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, for (int colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) { ColourInternal &C = colour_id_list_w2[colourId]; if (!_tcsncmp(C.group, group_buff, 64)) { - if (!sttFsuiBindColourIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) { + if (!sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) { FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData)); itemData->colour_id = colourId; itemData->font_id = -1; @@ -655,7 +653,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, for (int effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) { EffectInternal& E = effect_id_list_w2[effectId]; if (!_tcsncmp(E.group, group_buff, 64)) { - if (!sttFsuiBindEffectIdToFonts( GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) { + if (!sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) { FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData)); itemData->effect_id = effectId; itemData->font_id = -1; @@ -667,16 +665,16 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } SendDlgItemMessage(hwndDlg, IDC_FONTLIST, WM_SETREDRAW, TRUE, 0); - UpdateWindow( GetDlgItem(hwndDlg, IDC_FONTLIST)); + UpdateWindow(GetDlgItem(hwndDlg, IDC_FONTLIST)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETSEL, TRUE, 0); SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FONTLIST, LBN_SELCHANGE), 0); } else { - EnableWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOUR), FALSE); - EnableWindow( GetDlgItem(hwndDlg, IDC_FONTCOLOUR), FALSE); - EnableWindow( GetDlgItem(hwndDlg, IDC_CHOOSEFONT), FALSE); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_RESET), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCOLOUR), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSEFONT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_RESET), FALSE); ShowEffectButton(hwndDlg, FALSE); } } @@ -881,7 +879,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); - for (i=0; i < selCount; i++) { + for (i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -905,12 +903,12 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } else bEnableFont = bEnableClText = bEnableClBack = bEnableReset = bEnableEffect = 0; - EnableWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bEnableClBack); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bEnableClBack); ShowEffectButton(hwndDlg, bEnableEffect && !bEnableClBack); - EnableWindow( GetDlgItem(hwndDlg, IDC_FONTCOLOUR), bEnableClText); - EnableWindow( GetDlgItem(hwndDlg, IDC_CHOOSEFONT), bEnableFont); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_RESET), bEnableReset); + EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCOLOUR), bEnableClText); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSEFONT), bEnableFont); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_RESET), bEnableReset); if (bEnableClBack) SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, clBack); if (bEnableClText) SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETCOLOUR, 0, clText); @@ -926,7 +924,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_CHOOSEFONT: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); if (itemData->font_id < 0) { @@ -956,7 +954,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } if (ChooseFont(&cf)) { - for (i=0; i < selCount; i++) { + for (i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->font_id < 0) continue; @@ -971,11 +969,11 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mis.CtlID = IDC_FONTLIST; mis.itemID = selItems[i]; mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)& mis); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); } - InvalidateRect( GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } @@ -986,13 +984,13 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_EFFECT: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); EffectInternal& E = effect_id_list_w2[itemData->effect_id]; FONTEFFECT es = E.value; if (IDOK == DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndDlg, ChooseEffectDlgProc, (LPARAM)&es)) { - for (int i=0; i < selCount; i++) { + for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->effect_id < 0) continue; @@ -1000,8 +998,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, EffectInternal& E1 = effect_id_list_w2[itemData->effect_id]; E1.value = es; } - InvalidateRect( GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } @@ -1012,35 +1010,35 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_FONTCOLOUR: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (int i=0; i < selCount; i++) { + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->font_id < 0) continue; font_id_list_w2[itemData->font_id].value.colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0); } mir_free(selItems); - InvalidateRect( GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } break; case IDC_BKGCOLOUR: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (i=0; i < selCount; i++) { + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + for (i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->colour_id < 0) continue; colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); - if ( _tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0) { + if (_tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0) { if (hBkgColourBrush) DeleteObject(hBkgColourBrush); hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value); } } mir_free(selItems); - InvalidateRect( GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } break; @@ -1048,7 +1046,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0))) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); - for (i=0; i < selCount; i++) { + for (i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -1059,7 +1057,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mis.CtlID = IDC_FONTLIST; mis.itemID = selItems[i]; mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)& mis); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); } @@ -1071,9 +1069,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } mir_free(selItems); - InvalidateRect( GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FONTLIST, LBN_SELCHANGE), 0); - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } break; @@ -1082,7 +1080,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TCHAR fname_buff[MAX_PATH], filter[MAX_PATH]; mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0); - OPENFILENAME ofn = {0}; + OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = fname_buff; ofn.lpstrFile[0] = '\0'; @@ -1104,7 +1102,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, font_id_list_w2 = font_id_list_w3; colour_id_list_w2 = colour_id_list_w3; effect_id_list_w2 = effect_id_list_w3; - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), FALSE); SendMessage(hwndDlg, UM_SETFONTGROUP, 0, 0); break; @@ -1113,32 +1111,32 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) { + if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { char str[32]; font_id_list_w3 = font_id_list; colour_id_list_w3 = colour_id_list; effect_id_list_w3 = effect_id_list; - EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); font_id_list = font_id_list_w2; colour_id_list = colour_id_list_w2; effect_id_list = effect_id_list_w2; - for (i=0; i < font_id_list_w2.getCount(); i++) { + for (i = 0; i < font_id_list_w2.getCount(); i++) { FontInternal& F = font_id_list_w2[i]; sttSaveFontData(hwndDlg, F); } - for (i=0; i < colour_id_list_w2.getCount(); i++) { + for (i = 0; i < colour_id_list_w2.getCount(); i++) { ColourInternal& C = colour_id_list_w2[i]; strncpy_s(str, C.setting, _TRUNCATE); db_set_dw(NULL, C.dbSettingsGroup, str, C.value); } - for (i=0; i < effect_id_list_w2.getCount(); i++) { + for (i = 0; i < effect_id_list_w2.getCount(); i++) { EffectInternal& E = effect_id_list_w2[i]; mir_snprintf(str, SIZEOF(str), "%sEffect", E.setting); @@ -1155,8 +1153,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE; } - if (((LPNMHDR) lParam)->idFrom == IDC_FONTGROUP) { - switch(((NMHDR*)lParam)->code) { + if (((LPNMHDR)lParam)->idFrom == IDC_FONTGROUP) { + switch (((NMHDR*)lParam)->code) { case TVN_SELCHANGED: SendMessage(hwndDlg, UM_SETFONTGROUP, 0, 0); break; @@ -1175,7 +1173,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_DESTROY: KillTimer(hwndDlg, TIMER_ID); - sttSaveCollapseState( GetDlgItem(hwndDlg, IDC_FONTGROUP)); + sttSaveCollapseState(GetDlgItem(hwndDlg, IDC_FONTGROUP)); DeleteObject(hBkgColourBrush); font_id_list_w2.destroy(); font_id_list_w3.destroy(); @@ -1183,7 +1181,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, colour_id_list_w3.destroy(); effect_id_list_w2.destroy(); effect_id_list_w3.destroy(); - sttFreeListItems( GetDlgItem(hwndDlg, IDC_FONTLIST)); + sttFreeListItems(GetDlgItem(hwndDlg, IDC_FONTLIST)); break; } return FALSE; @@ -1205,10 +1203,9 @@ int OptInit(WPARAM wParam, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// -static FontInternal *sttFindFont(OBJLIST &fonts, char *module, char *prefix) +static FontInternal* sttFindFont(OBJLIST &fonts, char *module, char *prefix) { - for (int i=0; i < fonts.getCount(); i++) - { + for (int i = 0; i < fonts.getCount(); i++) { FontInternal& F = fonts[i]; if (!mir_strcmp(F.dbSettingsGroup, module) && !mir_strcmp(F.prefix, prefix)) return &F; @@ -1239,9 +1236,8 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar case WM_DRAWITEM: { FontInternal *pf = 0; - DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; - switch (dis->CtlID) - { + DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; + switch (dis->CtlID) { case IDC_PREVIEWHEADER: pf = &fntHeader; break; @@ -1260,11 +1256,11 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar COLORREF clText = GetSysColor(COLOR_WINDOWTEXT); CreateFromFontSettings(&pf->value, &lf); hFont = CreateFontIndirect(&lf); - hoFont = (HFONT) SelectObject(dis->hDC, hFont); + hoFont = (HFONT)SelectObject(dis->hDC, hFont); SetBkMode(dis->hDC, TRANSPARENT); SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT)); FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_BTNFACE)); - DrawText(dis->hDC, TranslateT("Sample text"), -1, &dis->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS|DT_CENTER); + DrawText(dis->hDC, TranslateT("Sample text"), -1, &dis->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS | DT_CENTER); if (hoFont) SelectObject(dis->hDC, hoFont); return TRUE; @@ -1308,9 +1304,9 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar pf->value.charset = lf.lfCharSet; _tcsncpy_s(pf->value.szFace, lf.lfFaceName, _TRUNCATE); - InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), NULL, TRUE); - InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), NULL, TRUE); - InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWSMALL), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWSMALL), NULL, TRUE); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } @@ -1319,22 +1315,22 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) { - for (i=0; i < font_id_list.getCount(); i++) { + if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { + for (i = 0; i < font_id_list.getCount(); i++) { FontInternal &F = font_id_list[i]; - if (F.deffontsettings.charset == SYMBOL_CHARSET) continue; + if (F.deffontsettings.charset == SYMBOL_CHARSET) + continue; COLORREF cl = F.value.colour; - if ( F.isHeader()) + if (F.isHeader()) F.value = fntHeader.value; + else if ((F.flags & FIDF_CLASSMASK) == FIDF_CLASSSMALL) + F.value = fntSmall.value; else - if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSSMALL) - F.value = fntSmall.value; - else - F.value = fntGeneral.value; + F.value = fntGeneral.value; - F.value.colour = cl; - sttSaveFontData(hwndDlg, F); + F.value.colour = cl; + sttSaveFontData(hwndDlg, F); } OptionsChanged(); @@ -1383,7 +1379,6 @@ int FontsModernOptInit(WPARAM wParam, LPARAM lParam) obj.iSection = MODERNOPT_PAGE_MODULES; obj.iType = MODERNOPT_TYPE_SECTIONPAGE; -// obj.lptzSubsection = LPGENT("Installed Plugins"); obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_MODULES); obj.pfnDlgProc = DlgPluginOpt; obj.iBoldControls = iBoldControls; diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index b8454dbd75..c856cd8b30 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -42,7 +42,7 @@ struct IcoLibOptsData static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) { TCHAR *comma; - TCHAR file[ MAX_PATH ], fileFull[ MAX_PATH ]; + TCHAR file[MAX_PATH], fileFull[MAX_PATH]; int n; HICON hIcon; @@ -54,7 +54,7 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) if (!comma) n = 0; else { - n = _ttoi(comma+1); + n = _ttoi(comma + 1); *comma = 0; } PathToAbsoluteT(file, fileFull); @@ -148,14 +148,14 @@ static void __fastcall MySetCursor(TCHAR* nCursor) static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) { - TCHAR path[ MAX_PATH ]; + TCHAR path[MAX_PATH]; mir_sntprintf(path, SIZEOF(path), _T("%s,"), filename); size_t suffIndx = mir_tstrlen(path); mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) { - IcolibItem *item = iconList[ indx ]; + IcolibItem *item = iconList[indx]; if (item->default_file && item->section == sectionActive) { _itot(item->default_indx, path + suffIndx, 10); @@ -181,7 +181,7 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) TreeView_GetItem(htv, &tvi); TreeItem *treeItem = (TreeItem *)tvi.lParam; - SectionItem* sectionActive = sectionList[ SECTIONPARAM_INDEX(treeItem->value) ]; + SectionItem* sectionActive = sectionList[SECTIONPARAM_INDEX(treeItem->value)]; tvi.hItem = TreeView_GetChild(htv, tvi.hItem); while (tvi.hItem) { @@ -195,7 +195,7 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) static void UndoChanges(int iconIndx, int cmd) { - IcolibItem *item = iconList[ iconIndx ]; + IcolibItem *item = iconList[iconIndx]; if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE) item->temp_reset = FALSE; @@ -210,7 +210,7 @@ static void UndoChanges(int iconIndx, int cmd) void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd) { - TVITEM tvi = {0}; + TVITEM tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hItem; TreeView_GetItem(htv, &tvi); @@ -220,7 +220,7 @@ void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd) mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) - if (iconList[ indx ]->section == sectionList[ SECTIONPARAM_INDEX(treeItem->value) ]) + if (iconList[indx]->section == sectionList[SECTIONPARAM_INDEX(treeItem->value)]) UndoChanges(indx, cmd); } @@ -246,15 +246,15 @@ static int OpenPopupMenu(HWND hwndDlg) hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT)); hPopup = GetSubMenu(hMenu, 0); TranslateMenu(hPopup); - cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); DestroyMenu(hMenu); return cmd; } static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) { - OPENFILENAME ofn = {0}; - TCHAR filter[512], *pfilter, file[MAX_PATH*2]; + OPENFILENAME ofn = { 0 }; + TCHAR filter[512], *pfilter, file[MAX_PATH * 2]; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hParent; @@ -265,7 +265,7 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) else mir_tstrcat(filter, _T(" (*.dll)")); - pfilter = filter+mir_tstrlen(filter)+1; + pfilter = filter + mir_tstrlen(filter) + 1; if (bAll) mir_tstrcpy(pfilter, _T("*.DLL;*.ICL;*.EXE;*.ICO")); else @@ -284,7 +284,7 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) mir_tstrncpy(file, szFile, SIZEOF(file)); ofn.lpstrFile = file; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT; - ofn.nMaxFile = MAX_PATH*2; + ofn.nMaxFile = MAX_PATH * 2; if (!GetOpenFileName(&ofn)) return NULL; @@ -335,7 +335,7 @@ void DoIconsChanged(HWND hwndDlg) static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name) { - TVITEM tvi = {0}; + TVITEM tvi = { 0 }; TCHAR str[MAX_PATH]; if (hItem) @@ -350,8 +350,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR tvi.pszText = str; tvi.cchTextMax = SIZEOF(str); - while (tvi.hItem) - { + while (tvi.hItem) { TreeView_GetItem(hwndTree, &tvi); if (!mir_tstrcmp(tvi.pszText, name)) @@ -396,7 +395,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hwndParent = (HWND)lParam; hPreview = GetDlgItem(hwndDlg, IDC_PREVIEW); dragging = dragItem = 0; - ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 0, 100), LVSIL_NORMAL); + ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100), LVSIL_NORMAL); ListView_SetIconSpacing(hPreview, 56, 67); { RECT rcThis, rcParent; @@ -404,20 +403,20 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM GetWindowRect(hwndDlg, &rcThis); GetWindowRect(hwndParent, &rcParent); - OffsetRect(&rcThis, rcParent.right-rcThis.left, 0); - OffsetRect(&rcThis, 0, rcParent.top-rcThis.top); + OffsetRect(&rcThis, rcParent.right - rcThis.left, 0); + OffsetRect(&rcThis, 0, rcParent.top - rcThis.top); GetWindowRect(GetParent(hwndParent), &rcParent); if (rcThis.right > cxScreen) { - OffsetRect(&rcParent, cxScreen-rcThis.right, 0); - OffsetRect(&rcThis, cxScreen-rcThis.right, 0); - MoveWindow(GetParent(hwndParent), rcParent.left, rcParent.top, rcParent.right-rcParent.left, rcParent.bottom-rcParent.top, TRUE); + OffsetRect(&rcParent, cxScreen - rcThis.right, 0); + OffsetRect(&rcThis, cxScreen - rcThis.right, 0); + MoveWindow(GetParent(hwndParent), rcParent.left, rcParent.top, rcParent.right - rcParent.left, rcParent.bottom - rcParent.top, TRUE); } - MoveWindow(hwndDlg, rcThis.left, rcThis.top, rcThis.right-rcThis.left, rcThis.bottom-rcThis.top, FALSE); + MoveWindow(hwndDlg, rcThis.left, rcThis.top, rcThis.right - rcThis.left, rcThis.bottom - rcThis.top, FALSE); GetClientRect(hwndDlg, &rcThis); - SendMessage(hwndDlg, WM_SIZE, 0, MAKELPARAM(rcThis.right-rcThis.left, rcThis.bottom-rcThis.top)); + SendMessage(hwndDlg, WM_SIZE, 0, MAKELPARAM(rcThis.right - rcThis.left, rcThis.bottom - rcThis.top)); } - SHAutoComplete( GetDlgItem(hwndDlg, IDC_ICONSET), 1); + SHAutoComplete(GetDlgItem(hwndDlg, IDC_ICONSET), 1); SetDlgItemText(hwndDlg, IDC_ICONSET, _T("icons.dll")); return TRUE; @@ -435,22 +434,22 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM RECT rcPreview, rcGroup; GetWindowRect(hPreview, &rcPreview); - GetWindowRect( GetDlgItem(hwndDlg, IDC_IMPORTMULTI), &rcGroup); + GetWindowRect(GetDlgItem(hwndDlg, IDC_IMPORTMULTI), &rcGroup); //SetWindowPos(hPreview, 0, 0, 0, rcPreview.right-rcPreview.left, rcGroup.bottom-rcPreview.top, SWP_NOZORDER|SWP_NOMOVE); } - if ( _taccess(filename, 0) != 0) { + if (_taccess(filename, 0) != 0) { MySetCursor(IDC_ARROW); break; } LVITEM lvi; - lvi.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM; + lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = 0; int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR); - for (int i=0; i < count; lvi.iItem++, i++) { - mir_sntprintf(caption, SIZEOF(caption), _T("%d"), i+1); + for (int i = 0; i < count; lvi.iItem++, i++) { + mir_sntprintf(caption, SIZEOF(caption), _T("%d"), i + 1); lvi.pszText = caption; HICON hIcon; @@ -465,7 +464,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_BROWSE: { TCHAR str[MAX_PATH], *file; @@ -553,7 +552,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_GetItem(hPreview, &lvi); mir_sntprintf(path, SIZEOF(path), _T("%s,%d"), filename, (int)lvi.lParam); SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path); - ListView_SetItemState( GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED); + ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED); } } break; @@ -567,7 +566,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dragging = 1; dragItem = ((LPNMLISTVIEW)lParam)->iItem; dropHiLite = -1; - ImageList_BeginDrag(ListView_GetImageList(hPreview, LVSIL_NORMAL), dragItem, GetSystemMetrics(SM_CXICON)/2, GetSystemMetrics(SM_CYICON)/2); + ImageList_BeginDrag(ListView_GetImageList(hPreview, LVSIL_NORMAL), dragItem, GetSystemMetrics(SM_CXICON) / 2, GetSystemMetrics(SM_CYICON) / 2); { POINT pt; RECT rc; @@ -585,7 +584,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_SIZE: // make the dlg resizeable if (!IsIconic(hwndDlg)) { - UTILRESIZEDIALOG urd = {0}; + UTILRESIZEDIALOG urd = { 0 }; urd.cbSize = sizeof(urd); urd.hInstance = hInst; urd.hwndDlg = hwndDlg; @@ -598,7 +597,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_CLOSE: DestroyWindow(hwndDlg); - EnableWindow( GetDlgItem(hwndParent, IDC_IMPORT), TRUE); + EnableWindow(GetDlgItem(hwndParent, IDC_IMPORT), TRUE); break; } @@ -684,7 +683,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // ListView_SetUnicodeFormat(hPreview, TRUE); ListView_SetExtendedListViewStyleEx(hPreview, LVS_EX_INFOTIP, LVS_EX_INFOTIP); - ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 0, 30), LVSIL_NORMAL); + ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 30), LVSIL_NORMAL); ListView_SetIconSpacing(hPreview, 56, 67); SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0); @@ -724,22 +723,22 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hItem = FindNamedTreeItemAt(hwndTree, hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { - TVINSERTSTRUCT tvis = {0}; + TVINSERTSTRUCT tvis = { 0 }; TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem)); treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE); treeItem->paramName = mir_t2a(itemName); tvis.hParent = hSection; tvis.hInsertAfter = TVI_SORT; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; tvis.item.pszText = pItemName; - tvis.item.lParam = (LPARAM) treeItem; + tvis.item.lParam = (LPARAM)treeItem; tvis.item.state = tvis.item.stateMask = db_get_b(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED); hItem = TreeView_InsertItem(hwndTree, &tvis); } else { - TVITEM tvi = {0}; + TVITEM tvi = { 0 }; tvi.hItem = hItem; tvi.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(hwndTree, &tvi); @@ -764,7 +763,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } break; - // Rebuild preview to new section + // Rebuild preview to new section case DM_REBUILDICONSPREVIEW: { SectionItem* sectionActive = (SectionItem*)lParam; @@ -777,7 +776,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (sectionActive == NULL) break; - LVITEM lvi = {0}; + LVITEM lvi = { 0 }; lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; { mir_cslock lck(csIconList); @@ -808,12 +807,12 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // Refresh preview to new section case DM_UPDATEICONSPREVIEW: { - LVITEM lvi = {0}; + LVITEM lvi = { 0 }; HICON hIcon; int indx, count; HIMAGELIST hIml = ListView_GetImageList(hPreview, LVSIL_NORMAL); - lvi.mask = LVIF_IMAGE|LVIF_PARAM; + lvi.mask = LVIF_IMAGE | LVIF_PARAM; count = ListView_GetItemCount(hPreview); for (indx = 0; indx < count; indx++) { @@ -837,13 +836,13 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // Temporary change icon - only inside options dialog case DM_CHANGEICON: { - LVITEM lvi = {0}; + LVITEM lvi = { 0 }; lvi.mask = LVIF_PARAM; lvi.iItem = wParam; ListView_GetItem(hPreview, &lvi); { mir_cslock lck(csIconList); - IcolibItem *item = iconList[ lvi.lParam ]; + IcolibItem *item = iconList[lvi.lParam]; SAFE_FREE((void**)&item->temp_file); SafeDestroyIcon(&item->temp_icon); @@ -867,12 +866,12 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; } else if (LOWORD(wParam) == IDC_LOADICONS) { - TCHAR filetmp[1] = {0}; + TCHAR filetmp[1] = { 0 }; TCHAR *file; if (file = OpenFileDlg(hwndDlg, filetmp, FALSE)) { HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST); - TCHAR filename[ MAX_PATH ]; + TCHAR filename[MAX_PATH]; PathToRelativeT(file, filename); SAFE_FREE((void**)&file); @@ -892,11 +891,11 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (count > 0) { int cmd = OpenPopupMenu(hwndDlg); - switch(cmd) { + switch (cmd) { case ID_CANCELCHANGE: case ID_RESET: { - LVITEM lvi = {0}; + LVITEM lvi = { 0 }; int itemIndx = -1; while ((itemIndx = ListView_GetNextItem(hPreview, itemIndx, LVNI_SELECTED)) != -1) { @@ -918,7 +917,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ((HWND)wParam == htv) { int cmd = OpenPopupMenu(hwndDlg); - switch(cmd) { + switch (cmd) { case ID_CANCELCHANGE: case ID_RESET: UndoSubItemChanges(htv, TreeView_GetSelection(htv), cmd); @@ -930,9 +929,9 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: - switch(((LPNMHDR)lParam)->code) { + switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { mir_cslock lck(csIconList); @@ -982,7 +981,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case IDC_CATEGORYLIST: - switch(((NMHDR*)lParam)->code) { + switch (((NMHDR*)lParam)->code) { case TVN_SELCHANGED: { NMTREEVIEW *pnmtv = (NMTREEVIEW*)lParam; @@ -990,8 +989,8 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeItem *treeItem = (TreeItem *)tvi.lParam; if (treeItem) SendMessage(hwndDlg, DM_REBUILDICONSPREVIEW, 0, (LPARAM)( - (SECTIONPARAM_FLAGS(treeItem->value)&SECTIONPARAM_HAVEPAGE)? - sectionList[ SECTIONPARAM_INDEX(treeItem->value) ] : NULL)); + (SECTIONPARAM_FLAGS(treeItem->value)&SECTIONPARAM_HAVEPAGE) ? + sectionList[SECTIONPARAM_INDEX(treeItem->value)] : NULL)); } break; @@ -1015,7 +1014,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_DESTROY: - SaveCollapseState( GetDlgItem(hwndDlg, IDC_CATEGORYLIST)); + SaveCollapseState(GetDlgItem(hwndDlg, IDC_CATEGORYLIST)); DestroyWindow(dat->hwndIndex); { mir_cslock lck(csIconList); -- cgit v1.2.3