From ebbbc63ddc421fffc217019714b8481bdd081c72 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Jun 2015 14:40:24 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14352 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdclist/src/clcopts.cpp | 124 ++++++++++++++++++----------------- src/core/stdclist/src/clcpaint.cpp | 24 +++---- src/core/stdclist/src/clistmenus.cpp | 6 +- src/core/stdclist/src/clistopts.cpp | 2 +- src/core/stdclist/src/cluiopts.cpp | 88 ++++++++++++------------- src/core/stdclist/src/init.cpp | 2 +- 6 files changed, 123 insertions(+), 123 deletions(-) (limited to 'src/core/stdclist') diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index f54350b67c..d50c7902d2 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -35,19 +35,20 @@ struct CheckBoxToStyleEx_t int not; } -static const checkBoxToStyleEx[] = { - {IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0}, - {IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1}, - {IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0}, - {IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0}, - {IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0}, - {IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0}, - {IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0}, - {IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1}, - {IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0}, - {IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0}, - {IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0}, - {IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1} +static const checkBoxToStyleEx[] = +{ + { IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0 }, + { IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1 }, + { IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0 }, + { IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0 }, + { IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0 }, + { IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0 }, + { IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0 }, + { IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1 }, + { IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0 }, + { IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0 }, + { IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0 }, + { IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1 } }; struct CheckBoxValues_t @@ -56,7 +57,8 @@ struct CheckBoxValues_t TCHAR* szDescr; }; -static const struct CheckBoxValues_t greyoutValues[] = { +static const struct CheckBoxValues_t greyoutValues[] = +{ { GREYF_UNFOCUS, LPGENT("Not focused") }, { MODEF_OFFLINE, LPGENT("Offline") }, { PF2_ONLINE, LPGENT("Online") }, @@ -70,7 +72,8 @@ static const struct CheckBoxValues_t greyoutValues[] = { { PF2_ONTHEPHONE, LPGENT("On the phone") } }; -static const struct CheckBoxValues_t offlineValues[] = { +static const struct CheckBoxValues_t offlineValues[] = +{ { MODEF_OFFLINE, LPGENT("Offline") }, { PF2_ONLINE, LPGENT("Online") }, { PF2_SHORTAWAY, LPGENT("Away") }, @@ -86,24 +89,23 @@ static const struct CheckBoxValues_t offlineValues[] = { static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { TVINSERTSTRUCT tvis; - int i; - tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; - for (i = 0; i < nValues; i++) { + for (int i = 0; i < nValues; i++) { tvis.item.lParam = values[i].style; - tvis.item.pszText = TranslateTS( values[i].szDescr ); + tvis.item.pszText = TranslateTS(values[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1); - TreeView_InsertItem( hwndTree, &tvis); -} } + TreeView_InsertItem(hwndTree, &tvis); + } +} static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) { DWORD flags = 0; - TVITEM tvi; + TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE; tvi.hItem = TreeView_GetRoot(hwndTree); while (tvi.hItem) { @@ -120,18 +122,17 @@ static LONG CalcMinRowHeight() LONG minHeight = 16; HDC hdc = GetDC(NULL); for (int i = 0; i < FONTID_LAST; i++) { - HFONT hFont; LOGFONT lf; COLORREF color; - SIZE fontSize; pcli->pfnGetFontSetting(i, &lf, &color); lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); - hFont = CreateFontIndirect(&lf); - hFont = ( HFONT )SelectObject(hdc, hFont); + HFONT hFont = CreateFontIndirect(&lf); + hFont = (HFONT)SelectObject(hdc, hFont); + SIZE fontSize; GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize); if (fontSize.cy > minHeight) minHeight = fontSize.cy; - hFont = ( HFONT )SelectObject(hdc,hFont); + hFont = (HFONT)SelectObject(hdc, hFont); DeleteObject(hFont); } ReleaseDC(NULL, hdc); @@ -156,9 +157,9 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED); } { - UDACCEL accel[2] = { {0, 10} , {2, 50} }; + UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } }; SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0)); - SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM) & accel); + SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)& accel); SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); } @@ -189,6 +190,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETPOS, 0, MAKELONG(rowHeight, 0)); } return TRUE; + case WM_SETFOCUS: { LONG minHeight = CalcMinRowHeight(); @@ -200,43 +202,46 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, minHeight)); } break; + case WM_VSCROLL: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; + case WM_COMMAND: if (LOWORD(wParam) == IDC_NOTNOSMOOTHSCROLLING) EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING)); if (LOWORD(wParam) == IDC_GREYOUT) EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)); if ((LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT - || LOWORD(wParam) == IDC_ROWHEIGHT) - && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + || LOWORD(wParam) == IDC_ROWHEIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; + case WM_NOTIFY: - switch (((LPNMHDR) lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case IDC_GREYOUTOPTS: case IDC_HIDEOFFLINEOPTS: - if (((LPNMHDR) lParam)->code == NM_CLICK) { + if (((LPNMHDR)lParam)->code == NM_CLICK) { TVHITTESTINFO hti; - hti.pt.x = (short) LOWORD(GetMessagePos()); - hti.pt.y = (short) HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt); - if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti)) + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); + if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) if (hti.flags & TVHT_ONITEMSTATEICON) { TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.hItem = hti.hItem; - TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi); + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1; - TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi); + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; + case 0: - if (((LPNMHDR) lParam)->code == PSN_APPLY ) { + if (((LPNMHDR)lParam)->code == PSN_APPLY) { int i; DWORD exStyle = 0; for (i = 0; i < _countof(checkBoxToStyleEx); i++) @@ -252,23 +257,21 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam else db_set_dw(NULL, "CLC", "GreyoutFlags", 0); } - db_set_b(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); + db_set_b(NULL, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS))); - db_set_b(NULL, "CLC", "LeftMargin", - (BYTE) SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, "CLC", "ScrollTime", - (WORD) SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "GroupIndent", - (BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); - db_set_b(NULL, "CLC", "RowHeight", (BYTE) SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CLC", "GammaCorrect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); + db_set_b(NULL, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); + db_set_w(NULL, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); + db_set_b(NULL, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); + db_set_b(NULL, "CLC", "RowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0)); + db_set_b(NULL, "CLC", "GammaCorrect", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); pcli->pfnClcOptionsChanged(); return TRUE; } break; } break; + case WM_DESTROY: ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), TVSIL_NORMAL)); break; @@ -297,7 +300,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemTextA(hwndDlg, IDC_FILENAME, dbv.pszVal); char szPath[MAX_PATH]; - if ( PathToAbsolute(dbv.pszVal, szPath)) + if (PathToAbsolute(dbv.pszVal, szPath)) SetDlgItemTextA(hwndDlg, IDC_FILENAME, szPath); db_free(&dbv); @@ -315,6 +318,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1); return TRUE; + case WM_USER + 10: EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); @@ -325,13 +329,15 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); EnableWindow(GetDlgItem(hwndDlg, IDC_PROPORTIONAL), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); break; + case WM_USER + 11: { BOOL b = IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR); EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), !b); EnableWindow(GetDlgItem(hwndDlg, IDC_SELCOLOUR), !b); - break; } + break; + case WM_COMMAND: if (LOWORD(wParam) == IDC_BROWSE) { TCHAR str[MAX_PATH], filter[512]; @@ -358,16 +364,17 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, WM_USER + 10, 0, 0); if (LOWORD(wParam) == IDC_WINCOLOUR) SendMessage(hwndDlg, WM_USER + 11, 0, 0); - if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); 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: - db_set_b(NULL, "CLC", "UseBitmap", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + db_set_b(NULL, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); { COLORREF col; col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); @@ -385,7 +392,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { char str[MAX_PATH], strrel[MAX_PATH]; GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, _countof(str)); - if ( PathToRelative(str, strrel)) + if (PathToRelative(str, strrel)) db_set_s(NULL, "CLC", "BkBitmap", strrel); else db_set_s(NULL, "CLC", "BkBitmap", str); @@ -445,8 +452,7 @@ int ClcModernOptInit(WPARAM wParam, LPARAM lParam) MODERNOPT_CTRL_LAST }; - MODERNOPTOBJECT obj = {0}; - + MODERNOPTOBJECT obj = { 0 }; obj.cbSize = sizeof(obj); obj.dwFlags = MODEROPT_FLG_TCHAR; obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index c81daf2932..7b856f5d19 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -83,7 +83,7 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) newCol = RGB(r, g, b); } else newCol = dat->hotTextColour; - + SetTextColor(hdc, newCol); } else SetTextColor(hdc, dat->hotTextColour); @@ -92,15 +92,15 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) static int GetStatusOnlineness(int status) { switch (status) { - case ID_STATUS_FREECHAT: return 110; - case ID_STATUS_ONLINE: return 100; - case ID_STATUS_OCCUPIED: return 60; - case ID_STATUS_ONTHEPHONE: return 50; - case ID_STATUS_DND: return 40; - case ID_STATUS_AWAY: return 30; - case ID_STATUS_OUTTOLUNCH: return 20; - case ID_STATUS_NA: return 10; - case ID_STATUS_INVISIBLE: return 5; + case ID_STATUS_FREECHAT: return 110; + case ID_STATUS_ONLINE: return 100; + case ID_STATUS_OCCUPIED: return 60; + case ID_STATUS_ONTHEPHONE: return 50; + case ID_STATUS_DND: return 40; + case ID_STATUS_AWAY: return 30; + case ID_STATUS_OUTTOLUNCH: return 20; + case ID_STATUS_NA: return 10; + case ID_STATUS_INVISIBLE: return 5; } return 0; } @@ -526,7 +526,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) DeleteDC(hdcMem); if (hBrushAlternateGrey) DeleteObject(hBrushAlternateGrey); - + if (grey) { BITMAPINFOHEADER bmih = { 0 }; bmih.biBitCount = 32; @@ -537,7 +537,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) bmih.biWidth = clRect.right; PBYTE bits = (PBYTE)malloc(4 * bmih.biWidth * -bmih.biHeight); GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *)& bmih, DIB_RGB_COLORS); - + COLORREF greyColour = GetSysColor(COLOR_3DFACE); int greyRed = GetRValue(greyColour) * 2; int greyGreen = GetGValue(greyColour) * 2; diff --git a/src/core/stdclist/src/clistmenus.cpp b/src/core/stdclist/src/clistmenus.cpp index cf8f512f43..3903953df5 100644 --- a/src/core/stdclist/src/clistmenus.cpp +++ b/src/core/stdclist/src/clistmenus.cpp @@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -INT_PTR CloseAction(WPARAM wParam,LPARAM lParam) +INT_PTR CloseAction(WPARAM wParam, LPARAM lParam) { - if (CallService(MS_SYSTEM_OKTOEXIT,0,0)) + if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0)) DestroyWindow(pcli->hwndContactList); return(0); @@ -34,5 +34,5 @@ INT_PTR CloseAction(WPARAM wParam,LPARAM lParam) void InitCustomMenus() { - CreateServiceFunction( "CloseAction", CloseAction ); + CreateServiceFunction("CloseAction", CloseAction); } diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 4c4d871ec1..eb54908883 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -124,7 +124,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0); - + int count; PROTOACCOUNT **accs; Proto_EnumAccounts(&count, &accs); diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 76dacac9c2..b8db5f0dd0 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -74,11 +74,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } { DBVARIANT dbv; - if ( !db_get_ts(NULL, "CList", "TitleText", &dbv)) { - SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal); - db_free( &dbv ); - } - else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); + if (!db_get_ts(NULL, "CList", "TitleText", &dbv)) { + SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal); + db_free(&dbv); + } + else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); } CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); @@ -130,7 +130,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) && - (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; // Enable apply button @@ -149,27 +149,26 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->code == PSN_APPLY) - { - db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); - db_set_b(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); - db_set_b(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); - db_set_b(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); - db_set_b(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); - db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); - db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); - db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); - db_set_w(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); - db_set_b(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); - db_set_b(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); - db_set_b(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); - db_set_b(NULL, "CLUI", "DockToSides", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING)); - db_set_b(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); - db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); - db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); - db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); + if (((LPNMHDR)lParam)->code == PSN_APPLY) { + db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); + db_set_b(NULL, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); + db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); + db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); + db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); + db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); + db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); + db_set_b(NULL, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + db_set_b(NULL, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); + db_set_b(NULL, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); + db_set_b(NULL, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); + db_set_b(NULL, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); + db_set_b(NULL, "CLUI", "DockToSides", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING)); + db_set_b(NULL, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); + db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); + db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); { TCHAR title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title)); @@ -181,8 +180,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) { // Window must be hidden to dynamically remove the taskbar button. // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp WINDOWPLACEMENT p; @@ -196,8 +194,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW); - if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { HWND hProgMan = FindWindow(_T("Progman"), NULL); if (hProgMan) SetParent(pcli->hwndContactList, hProgMan); @@ -205,13 +202,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L else SetParent(pcli->hwndContactList, NULL); - if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) { int style = GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, style); } - else - { + else { SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); } @@ -226,8 +221,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); - if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } @@ -285,20 +279,20 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->code == PSN_APPLY ) { - db_set_b(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + if (((LPNMHDR)lParam)->code == PSN_APPLY) { + db_set_b(NULL, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); db_set_b(NULL, "CLUI", "SBarShow", - (BYTE) ((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | + (BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0))); - db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); - db_set_b(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); - db_set_b(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); + db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); + db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); + db_set_b(NULL, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); pcli->pfnLoadCluiGlobalOpts(); - if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { + if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { HWND parent = GetParent(pcli->hwndStatus); int flags = WS_CHILD | CCS_BOTTOM; - db_set_b(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); + db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); ShowWindow(pcli->hwndStatus, SW_HIDE); DestroyWindow(pcli->hwndStatus); flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; @@ -346,10 +340,10 @@ int CluiModernOptInit(WPARAM wParam, LPARAM lParam) MODERNOPT_CTRL_LAST }; - MODERNOPTOBJECT obj = {0}; + MODERNOPTOBJECT obj = { 0 }; obj.cbSize = sizeof(obj); - obj.dwFlags = MODEROPT_FLG_TCHAR|MODEROPT_FLG_NORESIZE; + obj.dwFlags = MODEROPT_FLG_TCHAR | MODEROPT_FLG_NORESIZE; obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); obj.hInstance = g_hInst; obj.iSection = MODERNOPT_PAGE_CLIST; diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index b32e638200..efb6a00d7c 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -66,7 +66,7 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB, UNICODE_AWARE, //{240A91DC-9464-457a-9787-FF1EA88E77E2} - {0x240a91dc, 0x9464, 0x457a, { 0x97, 0x87, 0xff, 0x1e, 0xa8, 0x8e, 0x77, 0xe2 }} + { 0x240a91dc, 0x9464, 0x457a, { 0x97, 0x87, 0xff, 0x1e, 0xa8, 0x8e, 0x77, 0xe2 } } }; extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) -- cgit v1.2.3