Index: src/ch/StaticEx.cpp =================================================================== diff -u -rd5c3edd0d167db9b5d47d04248820fda49499a5e -r8068e0c351055554340ac9755d1bc846893bf2b8 --- src/ch/StaticEx.cpp (.../StaticEx.cpp) (revision d5c3edd0d167db9b5d47d04248820fda49499a5e) +++ src/ch/StaticEx.cpp (.../StaticEx.cpp) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) @@ -33,23 +33,23 @@ case WM_NCCREATE: { STATICEXSETTINGS* pSett=new STATICEXSETTINGS; - pSett->hFontNormal=NULL; - pSett->hFontUnderline=NULL; - pSett->pszLink=NULL; - pSett->pszText=NULL; + pSett->hFontNormal=nullptr; + pSett->hFontUnderline=nullptr; + pSett->pszLink=nullptr; + pSett->pszText=nullptr; pSett->bActive=false; pSett->bDown=false; - pSett->hLink=NULL; - pSett->hNormal=NULL; + pSett->hLink=nullptr; + pSett->hNormal=nullptr; pSett->rcText.left=0; pSett->rcText.right=0; pSett->rcText.top=0; pSett->rcText.bottom=0; ::SetWindowLongPtr(hwnd, 0, (LONG_PTR)pSett); // create cursors - pSett->hNormal=::LoadCursor(NULL, IDC_ARROW); - pSett->hLink=::LoadCursor(NULL, IDC_HAND); + pSett->hNormal=::LoadCursor(nullptr, IDC_ARROW); + pSett->hLink=::LoadCursor(nullptr, IDC_HAND); break; } @@ -59,11 +59,11 @@ const TCHAR* pSep=_tcsrchr(pcs->lpszName, _T('|')); - if (!(pcs->style & SES_LINK) || pSep == NULL || pSep-pcs->lpszName < 0) + if (!(pcs->style & SES_LINK) || pSep == nullptr || pSep-pcs->lpszName < 0) { pSettings->pszText=new TCHAR[_tcslen(pcs->lpszName)+1]; _tcscpy(pSettings->pszText, pcs->lpszName); - pSettings->pszLink=NULL; + pSettings->pszLink=nullptr; } else { @@ -119,8 +119,8 @@ } else { - pSettings->hFontNormal=NULL; - pSettings->hFontUnderline=NULL; + pSettings->hFontNormal=nullptr; + pSettings->hFontUnderline=nullptr; } break; @@ -137,11 +137,11 @@ LPCTSTR psz=(LPCTSTR)lParam; const TCHAR* pSep=_tcsrchr(psz, _T('|')); - if (!(lStyle & SES_LINK) || pSep == NULL || pSep-psz < 0) + if (!(lStyle & SES_LINK) || pSep == nullptr || pSep-psz < 0) { pSettings->pszText=new TCHAR[_tcslen(psz)+1]; _tcscpy(pSettings->pszText, psz); - pSettings->pszLink=NULL; + pSettings->pszLink=nullptr; } else { @@ -153,13 +153,12 @@ _tcscpy(pSettings->pszLink, pSep); } - ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); break; } case WM_ERASEBKGND: { return (LRESULT)FALSE; - break; } case WM_PAINT: { @@ -171,19 +170,19 @@ HDC hdc=::CreateCompatibleDC(hDC); HBITMAP hBmp=::CreateCompatibleBitmap(hDC, ps.rcPaint.right-ps.rcPaint.left+1, ps.rcPaint.bottom-ps.rcPaint.top+1); HBITMAP hOldBitmap=(HBITMAP)::SelectObject(hdc, hBmp); - ::SetWindowOrgEx(hdc, ps.rcPaint.left, ps.rcPaint.top, NULL); + ::SetWindowOrgEx(hdc, ps.rcPaint.left, ps.rcPaint.top, nullptr); // paint the background - ::FillRect(hdc, &ps.rcPaint, (HBRUSH)::SendMessage((HWND)::GetWindowLong(hwnd, GWLP_HWNDPARENT), WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd)); + ::FillRect(hdc, &ps.rcPaint, ::GetSysColorBrush(COLOR_BTNFACE)); // size of the all control RECT rcCtl; ::GetClientRect(hwnd, &rcCtl); // draw text - DWORD dwFlags=DT_LEFT | DT_VCENTER | (::GetWindowLong(hwnd, GWL_STYLE) & SES_PATHELLIPSIS ? DT_PATH_ELLIPSIS : 0) - | (::GetWindowLong(hwnd, GWL_STYLE) & SES_ELLIPSIS ? DT_END_ELLIPSIS : 0) - | (::GetWindowLong(hwnd, GWL_STYLE) & SES_WORDBREAK ? DT_WORDBREAK : 0); + DWORD dwFlags=DT_LEFT | DT_VCENTER | ((::GetWindowLong(hwnd, GWL_STYLE) & SES_PATHELLIPSIS) ? DT_PATH_ELLIPSIS : 0) + | ((::GetWindowLong(hwnd, GWL_STYLE) & SES_ELLIPSIS) ? DT_END_ELLIPSIS : 0) + | ((::GetWindowLong(hwnd, GWL_STYLE) & SES_WORDBREAK) ? DT_WORDBREAK : 0); pSettings->rcText=rcCtl; if (::GetWindowLong(hwnd, GWL_STYLE) & SES_LINK) @@ -260,7 +259,7 @@ { pSettings->bActive=false; ::ReleaseCapture(); - ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); ::SetCursor(pSettings->hNormal); } @@ -270,7 +269,7 @@ if (::PtInRect(&pSettings->rcText, pt)) { pSettings->bActive=true; - ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); ::SetCapture(hwnd); ::SetCursor(pSettings->hLink); } @@ -290,13 +289,13 @@ { if (::GetWindowLong(hwnd, GWL_STYLE) & SES_NOTIFY) { - ::SendMessage((HWND)::GetWindowLong(hwnd, GWLP_HWNDPARENT), WM_COMMAND, (WPARAM)(SEN_CLICKED << 16 | ::GetWindowLong(hwnd, GWL_ID)), (LPARAM)hwnd); + ::SendMessage((HWND)::GetWindowLongPtr(hwnd, GWLP_HWNDPARENT), WM_COMMAND, (WPARAM)(SEN_CLICKED << 16 | ::GetWindowLong(hwnd, GWL_ID)), (LPARAM)hwnd); } else { TRACE("Executing %s...\n", pSettings->pszLink); - ShellExecute(NULL, _T("open"), pSettings->pszLink, NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, _T("open"), pSettings->pszLink, nullptr, nullptr, SW_SHOWNORMAL); } } pSettings->bDown=false; @@ -314,12 +313,11 @@ // wParam - count // lParam - addr of a buffer if (pSettings->pszLink) - _tcsncpy((PTSTR)lParam, pSettings->pszLink, (int)wParam); + _tcsncpy((PTSTR)lParam, pSettings->pszLink, boost::numeric_cast(wParam)); else _tcscpy((PTSTR)lParam, _T("")); return (LRESULT)TRUE; - break; } } @@ -328,25 +326,25 @@ bool RegisterStaticExControl(HINSTANCE hInstance) { - WNDCLASS wndcls; + WNDCLASS wndcls; - if (!(::GetClassInfo(hInstance, STATICEX_CLASS, &wndcls))) - { - // need to register a new class - wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + if (!(::GetClassInfo(hInstance, STATICEX_CLASS, &wndcls))) + { + // need to register a new class + wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = ::StaticExWndProc; - wndcls.cbClsExtra = 0; + wndcls.cbClsExtra = 0; wndcls.cbWndExtra = sizeof(STATICEXSETTINGS*); - wndcls.hInstance = hInstance; - wndcls.hIcon = NULL; - wndcls.hCursor = NULL; // will load each time needed - wndcls.hbrBackground = NULL; - wndcls.lpszMenuName = NULL; - wndcls.lpszClassName = STATICEX_CLASS; + wndcls.hInstance = hInstance; + wndcls.hIcon = nullptr; + wndcls.hCursor = nullptr; // will load each time needed + wndcls.hbrBackground = nullptr; + wndcls.lpszMenuName = nullptr; + wndcls.lpszClassName = STATICEX_CLASS; - if (!RegisterClass(&wndcls)) - return false; - } + if (!RegisterClass(&wndcls)) + return false; + } - return true; + return true; }