From c730f12da81f636ecf65aa656a46b9337daaa37a Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 14 Dec 2014 21:30:16 +0000 Subject: Clist_modern: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_toolbar.cpp | 144 ++++++++++++++-------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'plugins/Clist_modern/src/modern_toolbar.cpp') diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 0529ddcb98..259bab3da2 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -40,15 +40,15 @@ struct } static BTNS[] = { - { "MainMenu", LPGEN("Main menu"), "CList/ShowMainMenu", LPGEN("Main menu"), NULL, 100 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "StatusMenu", LPGEN("Status menu"), "CList/ShowStatusMenu", LPGEN("Status menu"), NULL, 105 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "AccoMgr", LPGEN("Accounts"), MS_PROTO_SHOWACCMGR, LPGEN("Accounts..."), NULL, 282 , IDI_ACCMGR, IDI_ACCMGR, TRUE }, - { "ShowHideOffline",LPGEN("Show/Hide offline contacts"), MS_CLIST_TOGGLEHIDEOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 110, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "FindUser",LPGEN("Find user"), "FindAdd/FindAddCommand", LPGEN("Find user"), NULL, 140 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "Options","Options", "Options/OptionsCommand", "Options", NULL, 150 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, - { "UseGroups",LPGEN("Use/Disable groups"), MS_CLIST_TOGGLEGROUPS, LPGEN("Use groups"), LPGEN("Disable groups"), 160, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, - { "EnableSounds",LPGEN("Enable/Disable sounds"), MS_CLIST_TOGGLESOUNDS, LPGEN("Enable sounds"), LPGEN("Disable sounds"), 170, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, - { "Minimize",LPGEN("Minimize"), "CList/ShowHide", LPGEN("Minimize"), NULL, 180 , IDI_RESETVIEW, IDI_RESETVIEW, FALSE } + { "MainMenu", LPGEN("Main menu"), "CList/ShowMainMenu", LPGEN("Main menu"), NULL, 100, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "StatusMenu", LPGEN("Status menu"), "CList/ShowStatusMenu", LPGEN("Status menu"), NULL, 105, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "AccoMgr", LPGEN("Accounts"), MS_PROTO_SHOWACCMGR, LPGEN("Accounts..."), NULL, 282, IDI_ACCMGR, IDI_ACCMGR, TRUE }, + { "ShowHideOffline", LPGEN("Show/Hide offline contacts"), MS_CLIST_TOGGLEHIDEOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 110, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "FindUser", LPGEN("Find user"), "FindAdd/FindAddCommand", LPGEN("Find user"), NULL, 140, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "Options", "Options", "Options/OptionsCommand", "Options", NULL, 150, IDI_RESETVIEW, IDI_RESETVIEW, TRUE }, + { "UseGroups", LPGEN("Use/Disable groups"), MS_CLIST_TOGGLEGROUPS, LPGEN("Use groups"), LPGEN("Disable groups"), 160, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, + { "EnableSounds", LPGEN("Enable/Disable sounds"), MS_CLIST_TOGGLESOUNDS, LPGEN("Enable sounds"), LPGEN("Disable sounds"), 170, IDI_RESETVIEW, IDI_RESETVIEW, FALSE }, + { "Minimize", LPGEN("Minimize"), "CList/ShowHide", LPGEN("Minimize"), NULL, 180, IDI_RESETVIEW, IDI_RESETVIEW, FALSE } }; static void SetButtonPressed(int i, int state) @@ -58,7 +58,7 @@ static void SetButtonPressed(int i, int state) void Modern_InitButtons() { - for (int i=0; i < SIZEOF(BTNS); i++) { + for (int i = 0; i < SIZEOF(BTNS); i++) { TTBButton tbb = { 0 }; tbb.cbSize = sizeof(tbb); @@ -70,20 +70,20 @@ void Modern_InitButtons() char buf[255]; if (i != 0) { - mir_snprintf(buf,SIZEOF(buf),"%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn"); + mir_snprintf(buf, SIZEOF(buf), "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn"); tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, _T("icons\\toolbar_icons.dll"), BTNS[i].icoDefIdx, g_hInst, BTNS[i].defResource); } else tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, NULL, 0, NULL, SKINICON_OTHER_MAINMENU); if (BTNS[i].pszTooltipDn) { - mir_snprintf(buf,SIZEOF(buf),"%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up"); - tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, _T("icons\\toolbar_icons.dll"), BTNS[i].icoDefIdx+1, g_hInst, BTNS[i].defResource2 ); + mir_snprintf(buf, SIZEOF(buf), "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up"); + tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, _T("icons\\toolbar_icons.dll"), BTNS[i].icoDefIdx + 1, g_hInst, BTNS[i].defResource2); } else tbb.hIconHandleDn = NULL; } else tbb.dwFlags |= TTBBF_ISSEPARATOR; - tbb.dwFlags |= (BTNS[i].bVisByDefault ? TTBBF_VISIBLE :0 ); + tbb.dwFlags |= (BTNS[i].bVisByDefault ? TTBBF_VISIBLE : 0); BTNS[i].hButton = TopToolbar_AddButton(&tbb); } @@ -118,21 +118,21 @@ static int ehhToolBarSettingsChanged(WPARAM hContact, LPARAM lParam) if (hContact != NULL) return 0; - if (!mir_strcmp(cws->szModule,"CList")) { - if (!mir_strcmp(cws->szSetting,"HideOffline")) + if (!mir_strcmp(cws->szModule, "CList")) { + if (!mir_strcmp(cws->szSetting, "HideOffline")) SetButtonPressed(3, cws->value.bVal); - else if (!mir_strcmp(cws->szSetting,"UseGroups")) + else if (!mir_strcmp(cws->szSetting, "UseGroups")) SetButtonPressed(6, cws->value.bVal); } - else if (!mir_strcmp(cws->szModule,"Skin")) { - if (!mir_strcmp(cws->szSetting,"UseSound")) + else if (!mir_strcmp(cws->szModule, "Skin")) { + if (!mir_strcmp(cws->szSetting, "UseSound")) SetButtonPressed(7, cws->value.bVal); } return 0; } -static int ehhToolBarBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) +static int ehhToolBarBackgroundSettingsChanged(WPARAM, LPARAM) { if (tbdat.mtb_hBmpBackground) { DeleteObject(tbdat.mtb_hBmpBackground); @@ -156,21 +156,21 @@ static int ehhToolBarBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT *rect, ModernToolbarCtrl* pMTBInfo) { - BOOL bFloat = (GetParent(hwnd)!=pcli->hwndContactList); + BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList); if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) { HBRUSH hbr; RECT rc; if (rect) - rc=*rect; + rc = *rect; else - GetClientRect(hwnd,&rc); + GetClientRect(hwnd, &rc); if (!(tbdat.mtb_backgroundBmpUse && tbdat.mtb_hBmpBackground) && tbdat.mtb_useWinColors) { HRESULT hr = S_FALSE; if (xpt_IsThemed(pMTBInfo->mtbXPTheme)) hr = xpt_DrawTheme(pMTBInfo->mtbXPTheme, pMTBInfo->hWnd, hdc, 0, 0, &rc, &rc); - + if (hr == S_FALSE) { hbr = GetSysColorBrush(COLOR_3DFACE); FillRect(hdc, &rc, hbr); @@ -188,7 +188,7 @@ static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT *rect, ModernToolb static void sttDrawNonLayeredSkinedBar(HWND hwnd, HDC hdc) { - RECT rc = {0}; + RECT rc = { 0 }; GetClientRect(hwnd, &rc); rc.right++; rc.bottom++; @@ -201,8 +201,8 @@ static void sttDrawNonLayeredSkinedBar(HWND hwnd, HDC hdc) } else ske_BltBackImage(hwnd, hdc2, &rc); - SendMessage(hwnd, MTBM_LAYEREDPAINT, (WPARAM)hdc2, 0); - BitBlt(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hdc2, rc.left, rc.top, SRCCOPY); + SendMessage(hwnd, MTBM_LAYEREDPAINT, (WPARAM)hdc2, 0); + BitBlt(hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, hdc2, rc.left, rc.top, SRCCOPY); SelectObject(hdc2, hbmpo); DeleteObject(hbmp); DeleteDC(hdc2); @@ -215,52 +215,52 @@ static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA { ModernToolbarCtrl* pMTBInfo = (ModernToolbarCtrl*)GetWindowLongPtr(hwnd, 0); - switch( msg ) { + switch (msg) { case WM_ERASEBKGND: return (g_CluiData.fDisableSkinEngine) ? sttDrawToolBarBackground(hwnd, (HDC)wParam, NULL, pMTBInfo) : 0; case WM_NCPAINT: case WM_PAINT: - { - PAINTSTRUCT ps; - BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList); - if (g_CluiData.fDisableSkinEngine|| !g_CluiData.fLayered || bFloat ) { - BeginPaint(hwnd,&ps); - if ((!g_CluiData.fLayered || bFloat) && !g_CluiData.fDisableSkinEngine) - sttDrawNonLayeredSkinedBar(hwnd, ps.hdc); - else - sttDrawToolBarBackground(hwnd, ps.hdc, &ps.rcPaint, pMTBInfo); - EndPaint(hwnd,&ps); - } + { + PAINTSTRUCT ps; + BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList); + if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) { + BeginPaint(hwnd, &ps); + if ((!g_CluiData.fLayered || bFloat) && !g_CluiData.fDisableSkinEngine) + sttDrawNonLayeredSkinedBar(hwnd, ps.hdc); + else + sttDrawToolBarBackground(hwnd, ps.hdc, &ps.rcPaint, pMTBInfo); + EndPaint(hwnd, &ps); } - return DefWindowProc(hwnd, msg, wParam, lParam); + } + return DefWindowProc(hwnd, msg, wParam, lParam); case WM_NOTIFY: - if (((LPNMHDR) lParam)->code == BUTTONNEEDREDRAW) + if (((LPNMHDR)lParam)->code == BUTTONNEEDREDRAW) pcli->pfnInvalidateRect(hwnd, NULL, FALSE); return 0; case MTBM_LAYEREDPAINT: - { - RECT MyRect={0}; - HDC hDC=(HDC)wParam; - GetWindowRect(hwnd,&MyRect); - - RECT rcClient; - GetClientRect(hwnd, &rcClient); - SkinDrawGlyph(hDC, &rcClient, &rcClient, "Bar,ID=ToolBar,Part=Background"); - - for (int i=0; i < pMTBInfo->pButtonList->realCount; i++) { - RECT childRect; - POINT Offset; - TTBCtrlButton* mtbi = (TTBCtrlButton*)pMTBInfo->pButtonList->items[i]; - GetWindowRect(mtbi->hWindow, &childRect); - Offset.x = childRect.left - MyRect.left; - Offset.y = childRect.top - MyRect.top; - SendMessage(mtbi->hWindow, BUTTONDRAWINPARENT, (WPARAM)hDC, (LPARAM)&Offset); - } + { + RECT MyRect = { 0 }; + HDC hDC = (HDC)wParam; + GetWindowRect(hwnd, &MyRect); + + RECT rcClient; + GetClientRect(hwnd, &rcClient); + SkinDrawGlyph(hDC, &rcClient, &rcClient, "Bar,ID=ToolBar,Part=Background"); + + for (int i = 0; i < pMTBInfo->pButtonList->realCount; i++) { + RECT childRect; + POINT Offset; + TTBCtrlButton* mtbi = (TTBCtrlButton*)pMTBInfo->pButtonList->items[i]; + GetWindowRect(mtbi->hWindow, &childRect); + Offset.x = childRect.left - MyRect.left; + Offset.y = childRect.top - MyRect.top; + SendMessage(mtbi->hWindow, BUTTONDRAWINPARENT, (WPARAM)hDC, (LPARAM)&Offset); } - return 0; + } + return 0; case WM_DESTROY: xpt_FreeThemeForWindow(hwnd); @@ -271,9 +271,9 @@ static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return mir_callNextSubclass(hwnd, toolbarWndProc, msg, wParam, lParam); } -static int ToolBar_LayeredPaintProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData) +static int ToolBar_LayeredPaintProc(HWND hWnd, HDC hDC, RECT *, HRGN, DWORD, void *) { - return SendMessage(hWnd, MTBM_LAYEREDPAINT,(WPARAM)hDC,0); + return SendMessage(hWnd, MTBM_LAYEREDPAINT, (WPARAM)hDC, 0); } void CustomizeToolbar(HWND hwnd) @@ -292,7 +292,7 @@ void CustomizeToolbar(HWND hwnd) Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME); pMTBInfo->hFrame = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0); - CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)hwnd,(LPARAM)ToolBar_LayeredPaintProc); + CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)hwnd, (LPARAM)ToolBar_LayeredPaintProc); pMTBInfo->mtbXPTheme = xpt_AddThemeHandle(hwnd, L"TOOLBAR"); pMTBInfo->bHardUpdate = TRUE; @@ -308,14 +308,14 @@ static TCHAR szWarning[] = LPGENT("To view a toolbar in Clist_modern you need th static void CopySettings(const char* to, const char* from, int defValue) { - db_set_b(NULL, TTB_OPTDIR, to, db_get_b(NULL,"ModernToolBar",from, defValue)); + db_set_b(NULL, TTB_OPTDIR, to, db_get_b(NULL, "ModernToolBar", from, defValue)); } ///////////////////////////////////////////////////////////////////////////////////////// void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam); -static int Toolbar_ModuleReloaded(WPARAM wParam, LPARAM lParam) +static int Toolbar_ModuleReloaded(WPARAM wParam, LPARAM) { PLUGININFOEX *pInfo = (PLUGININFOEX*)wParam; if (!_stricmp(pInfo->shortName, "TopToolBar")) @@ -326,7 +326,7 @@ static int Toolbar_ModuleReloaded(WPARAM wParam, LPARAM lParam) static int Toolbar_ModulesLoaded(WPARAM, LPARAM) { - CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Toolbar background")"/ToolBar"),0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Toolbar background")"/ToolBar"), 0); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ehhToolBarSettingsChanged); @@ -335,11 +335,11 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) BYTE bOldSetting = 0; if (!db_get_b(NULL, "Compatibility", "TTB_Upgrade", 0)) { if (bOldSetting = db_get_b(NULL, "CLUI", "ShowButtonBar", 1)) { - CopySettings("BUTTWIDTH", "option_Bar0_BtnWidth", 20); - CopySettings("BUTTHEIGHT", "option_Bar0_BtnHeight", 20); - CopySettings("BUTTGAP", "option_Bar0_BtnSpace", 1); - CopySettings("BUTTAUTOSIZE", "option_Bar0_Autosize", 1); - CopySettings("BUTTMULTI", "option_Bar0_Multiline", 1); + CopySettings("BUTTWIDTH", "option_Bar0_BtnWidth", 20); + CopySettings("BUTTHEIGHT", "option_Bar0_BtnHeight", 20); + CopySettings("BUTTGAP", "option_Bar0_BtnSpace", 1); + CopySettings("BUTTAUTOSIZE", "option_Bar0_Autosize", 1); + CopySettings("BUTTMULTI", "option_Bar0_Multiline", 1); db_unset(NULL, "CLUI", "ShowButtonBar"); @@ -348,7 +348,7 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) db_set_b(NULL, "Compatibility", "TTB_Upgrade", 1); } - if (!ServiceExists( MS_TTB_REMOVEBUTTON) && bOldSetting == 1) + if (!ServiceExists(MS_TTB_REMOVEBUTTON) && bOldSetting == 1) if (IDYES == MessageBox(NULL, TranslateTS(szWarning), TranslateT("Toolbar upgrade"), MB_ICONQUESTION | MB_YESNO)) CallService(MS_UTILS_OPENURL, 0, (LPARAM)szUrl); -- cgit v1.2.3