diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index f80f8729d..24f3bbe41 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -751,7 +751,7 @@ COLORREF getCtrlBgColor(HWND hWnd) HGDIOBJ hOld = SelectObject(hdcMem, hBmp); if (hOld) { - if (SendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hdcMem, 0)) + if (SendMessage(hWnd, WM_ERASEBKGND, reinterpret_cast(hdcMem), 0)) { crRet = GetPixel(hdcMem, 2, 2); // 0, 0 is usually on the border } diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 76c769306..96e660587 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -213,7 +213,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vectorgetExternalLexerFromXmlTree(pXmlDoc); nppParams->getExternalLexerDoc()->push_back(pXmlDoc); const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP); - ::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, (LPARAM)pDllName); + ::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast(pDllName)); } addInLoadedDlls(pluginFileName); diff --git a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp index e02c2178e..c1503ece7 100644 --- a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp +++ b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp @@ -131,20 +131,20 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar if (!_isCustomize) { auto index2Add = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETCURSEL, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETTEXT, index2Add, (LPARAM)ext2Add); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETTEXT, index2Add, reinterpret_cast(ext2Add)); addExt(ext2Add); ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_DELETESTRING, index2Add, 0); } else { - ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_GETTEXT, extNameMax, (LPARAM)ext2Add); - auto i = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, (LPARAM)ext2Add); + ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_GETTEXT, extNameMax, reinterpret_cast(ext2Add)); + auto i = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, reinterpret_cast(ext2Add)); if (i != LB_ERR) return TRUE; addExt(ext2Add); - ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_SETTEXT, 0, (LPARAM)TEXT("")); + ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_SETTEXT, 0, reinterpret_cast(TEXT(""))); } - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_ADDSTRING, 0, (LPARAM)ext2Add); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_ADDSTRING, 0, reinterpret_cast(ext2Add)); ::EnableWindow(::GetDlgItem(_hSelf, IDC_ADDFROMLANGEXT_BUTTON), false); return TRUE; } @@ -153,7 +153,7 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { TCHAR ext2Sup[extNameMax] = TEXT(""); auto index2Sup = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_GETCURSEL, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_GETTEXT, index2Sup, (LPARAM)ext2Sup); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_GETTEXT, index2Sup, reinterpret_cast(ext2Sup)); if (deleteExts(ext2Sup)) ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_DELETESTRING, index2Sup, 0); auto langIndex = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANG_LIST, LB_GETCURSEL, 0, 0); @@ -166,7 +166,7 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { if (!generic_stricmp(ext2Sup, defExtArray[langIndex][i])) { - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_ADDSTRING, 0, (LPARAM)ext2Sup); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_ADDSTRING, 0, reinterpret_cast(ext2Sup)); return TRUE; } } @@ -184,13 +184,13 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar if (HIWORD(wParam) == EN_CHANGE) { TCHAR text[extNameMax] = TEXT(""); - ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_GETTEXT, extNameMax, (LPARAM)text); + ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_GETTEXT, extNameMax, reinterpret_cast(text)); if ((lstrlen(text) == 1) && (text[0] != '.')) { text[1] = text[0]; text[0] = '.'; text[2] = '\0'; - ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_SETTEXT, 0, (LPARAM)text); + ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_SETTEXT, 0, reinterpret_cast(text)); ::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, EM_SETSEL, 2, 2); } ::EnableWindow(::GetDlgItem(_hSelf, IDC_ADDFROMLANGEXT_BUTTON), (lstrlen(text) > 1)); @@ -205,7 +205,7 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar if (i != LB_ERR) { TCHAR itemName[32]; - ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXT, i, (LPARAM)itemName); + ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXT, i, reinterpret_cast(itemName)); if (!generic_stricmp(defExtArray[nbSupportedLang-1][0], itemName)) { @@ -230,9 +230,9 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { if (lstrcmp(TEXT(""), defExtArray[i][j])) { - auto index = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, (LPARAM)defExtArray[i][j]); + auto index = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, reinterpret_cast(defExtArray[i][j])); if (index == -1) - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_ADDSTRING, 0, (LPARAM)defExtArray[i][j]); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_ADDSTRING, 0, reinterpret_cast(defExtArray[i][j])); } } } @@ -270,7 +270,7 @@ void RegExtDlg::getRegisteredExts() TCHAR extName[extNameLen]; //FILETIME fileTime; int extNameActualLen = extNameLen; - int res = ::RegEnumKeyEx(HKEY_CLASSES_ROOT, i, extName, (LPDWORD)&extNameActualLen, nullptr, nullptr, nullptr, nullptr); + int res = ::RegEnumKeyEx(HKEY_CLASSES_ROOT, i, extName, reinterpret_cast(&extNameActualLen), nullptr, nullptr, nullptr, nullptr); if ((res == ERROR_SUCCESS) && (extName[0] == '.')) { //TCHAR valName[extNameLen]; @@ -280,10 +280,10 @@ void RegExtDlg::getRegisteredExts() HKEY hKey2Check; extNameActualLen = extNameLen; ::RegOpenKeyEx(HKEY_CLASSES_ROOT, extName, 0, KEY_ALL_ACCESS, &hKey2Check); - ::RegQueryValueEx(hKey2Check, TEXT(""), nullptr, (LPDWORD)&valType, (LPBYTE)valData, (LPDWORD)&valDataLen); - //::RegEnumValue(hKey2Check, 0, valName, (LPDWORD)&extNameActualLen, nullptr, (LPDWORD)&valType, (LPBYTE)valData, (LPDWORD)&valDataLen); + ::RegQueryValueEx(hKey2Check, TEXT(""), nullptr, reinterpret_cast(&valType), reinterpret_cast(valData), reinterpret_cast(&valDataLen)); + if ((valType == REG_SZ) && (!lstrcmp(valData, nppName))) - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_ADDSTRING, 0, (LPARAM)extName); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_ADDSTRING, 0, reinterpret_cast(extName)); ::RegCloseKey(hKey2Check); } } @@ -293,7 +293,7 @@ void RegExtDlg::getRegisteredExts() void RegExtDlg::getDefSupportedExts() { for (int i = 0 ; i < nbSupportedLang ; ++i) - ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANG_LIST, LB_ADDSTRING, 0, (LPARAM)defExtArray[i][0]); + ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANG_LIST, LB_ADDSTRING, 0, reinterpret_cast(defExtArray[i][0])); } @@ -312,11 +312,11 @@ void RegExtDlg::addExt(TCHAR *ext) if (dwDisp == REG_OPENED_EXISTING_KEY) { - int res = ::RegQueryValueEx(hKey, TEXT(""), nullptr, nullptr, (LPBYTE)valData, (LPDWORD)&valDataLen); + int res = ::RegQueryValueEx(hKey, TEXT(""), nullptr, nullptr, reinterpret_cast(valData), reinterpret_cast(&valDataLen)); if (res == ERROR_SUCCESS) - ::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, (LPBYTE)valData, valDataLen); + ::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, reinterpret_cast(valData), valDataLen); } - ::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppName, (lstrlen(nppName)+1)*sizeof(TCHAR)); + ::RegSetValueEx(hKey, nullptr, 0, REG_SZ, reinterpret_cast(nppName), (lstrlen(nppName) + 1) * sizeof(TCHAR)); ::RegCloseKey(hKey); } diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3d653cb9f..fa6dfde87 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -969,7 +969,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const // Put data in _invisibleEditView _invisibleEditView.execute(SCI_CLEARALL); - _invisibleEditView.execute(SCI_APPENDTEXT, lenFile, (LPARAM)data); + _invisibleEditView.execute(SCI_APPENDTEXT, lenFile, reinterpret_cast(data)); const char *encodingAliasRegExpr = "[a-zA-Z0-9_-]+"; @@ -985,16 +985,16 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const _invisibleEditView.execute(SCI_SETTARGETRANGE, startPos, endPos); - auto posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(xmlHeaderRegExpr), (LPARAM)xmlHeaderRegExpr); + auto posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(xmlHeaderRegExpr), reinterpret_cast(xmlHeaderRegExpr)); if (posFound != -1 && posFound != -2) { const char *encodingBlockRegExpr = "encoding[ \\t]*=[ \\t]*\"[^\".]+\""; - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingBlockRegExpr), (LPARAM)encodingBlockRegExpr); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingBlockRegExpr), reinterpret_cast(encodingBlockRegExpr)); const char *encodingRegExpr = "\".+\""; - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingRegExpr), (LPARAM)encodingRegExpr); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingRegExpr), reinterpret_cast(encodingRegExpr)); - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingAliasRegExpr), (LPARAM)encodingAliasRegExpr); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingAliasRegExpr), reinterpret_cast(encodingAliasRegExpr)); startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART)); endPos = _invisibleEditView.execute(SCI_GETTARGETEND); @@ -1022,17 +1022,17 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const _invisibleEditView.execute(SCI_SETTARGETRANGE, startPos, endPos); - int posFound = static_cast(_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr), (LPARAM)htmlHeaderRegExpr)); + int posFound = static_cast(_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr), reinterpret_cast(htmlHeaderRegExpr))); if (posFound == -1 || posFound == -2) { - posFound = static_cast(_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr2), (LPARAM)htmlHeaderRegExpr2)); + posFound = static_cast(_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(htmlHeaderRegExpr2), reinterpret_cast(htmlHeaderRegExpr2))); if (posFound == -1 || posFound == -2) return -1; } - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(charsetBlock), (LPARAM)charsetBlock); - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(intermediaire), (LPARAM)intermediaire); - _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingStrRE), (LPARAM)encodingStrRE); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(charsetBlock), reinterpret_cast(charsetBlock)); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(intermediaire), reinterpret_cast(intermediaire)); + _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingStrRE), reinterpret_cast(encodingStrRE)); startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART)); endPos = _invisibleEditView.execute(SCI_GETTARGETEND); @@ -1142,7 +1142,7 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay) char * source = new char[docLength]; if (source == NULL) return; - _pEditView->execute(SCI_GETTEXT, docLength, (LPARAM)source); + _pEditView->execute(SCI_GETTEXT, docLength, reinterpret_cast(source)); if (whichWay == tab2Space) { @@ -1311,7 +1311,7 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay) } _pEditView->execute(SCI_BEGINUNDOACTION); - _pEditView->execute(SCI_SETTEXT, 0, (LPARAM)destination); + _pEditView->execute(SCI_SETTEXT, 0, reinterpret_cast(destination)); _pEditView->execute(SCI_GOTOPOS, newCurrentPos); for (size_t i=0; i(_pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR)); + int posFound = static_cast(_pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(URL_REG_EXPR))); while (posFound != -1 && posFound != -2) { @@ -2370,7 +2370,7 @@ void Notepad_plus::addHotSpot() Style hotspotStyle; hotspotStyle._styleID = static_cast(style_hotspot); - _pEditView->execute(SCI_STYLEGETFONT, idStyleMSBunset, (LPARAM)fontNameA); + _pEditView->execute(SCI_STYLEGETFONT, idStyleMSBunset, reinterpret_cast(fontNameA)); TCHAR *generic_fontname = new TCHAR[128]; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); @@ -2408,7 +2408,7 @@ void Notepad_plus::addHotSpot() _pEditView->execute(SCI_SETTARGETRANGE, posFound + foundTextLen, endPos); - posFound = static_cast(_pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR)); + posFound = static_cast(_pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(URL_REG_EXPR))); } _pEditView->execute(SCI_STARTSTYLING, endStyle, 0xFF); @@ -2427,7 +2427,7 @@ bool Notepad_plus::isConditionExprLine(int lineNumber) const char ifElseForWhileExpr[] = "((else[ \t]+)?if|for|while)[ \t]*[(].*[)][ \t]*|else[ \t]*"; - auto posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifElseForWhileExpr), (LPARAM)ifElseForWhileExpr); + auto posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifElseForWhileExpr), reinterpret_cast(ifElseForWhileExpr)); if (posFound != -1 && posFound != -2) { auto end = _pEditView->execute(SCI_GETTARGETEND); @@ -2511,7 +2511,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch) else eolChars = "\r"; - _pEditView->execute(SCI_INSERTTEXT, _pEditView->execute(SCI_GETCURRENTPOS), (LPARAM)eolChars); + _pEditView->execute(SCI_INSERTTEXT, _pEditView->execute(SCI_GETCURRENTPOS), reinterpret_cast(eolChars)); _pEditView->setLineIndent(curLine + 1, indentAmountPrevLine); } _pEditView->setLineIndent(curLine, indentAmountPrevLine + tabWidth); @@ -2564,7 +2564,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch) const char braceExpr[] = "[ \t]*\\{.*"; - int posFound = static_cast(_pEditView->execute(SCI_SEARCHINTARGET, strlen(braceExpr), (LPARAM)braceExpr)); + int posFound = static_cast(_pEditView->execute(SCI_SEARCHINTARGET, strlen(braceExpr), reinterpret_cast(braceExpr))); if (posFound != -1 && posFound != -2) { int end = int(_pEditView->execute(SCI_GETTARGETEND)); @@ -4708,11 +4708,11 @@ void Notepad_plus::doSynScorll(HWND whichView) { // Compute for Column mxoffset = static_cast(_mainEditView.execute(SCI_GETXOFFSET)); - pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); mainColumn = mxoffset/pixel; sxoffset = static_cast(_subEditView.execute(SCI_GETXOFFSET)); - pixel = static_cast(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + pixel = static_cast(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); subColumn = sxoffset/pixel; column = mainColumn - _syncInfo._column - subColumn; } @@ -4731,11 +4731,11 @@ void Notepad_plus::doSynScorll(HWND whichView) { // Compute for Column mxoffset = static_cast(_mainEditView.execute(SCI_GETXOFFSET)); - pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); mainColumn = mxoffset/pixel; sxoffset = static_cast(_subEditView.execute(SCI_GETXOFFSET)); - pixel = static_cast(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + pixel = static_cast(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); subColumn = sxoffset/pixel; column = subColumn + _syncInfo._column - mainColumn; } @@ -5536,7 +5536,7 @@ void Notepad_plus::launchClipboardHistoryPanel() tTbData data = {0}; _pClipboardHistoryPanel->create(&data); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pClipboardHistoryPanel->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pClipboardHistoryPanel->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_CLIPBOARDPANEL_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5554,7 +5554,7 @@ void Notepad_plus::launchClipboardHistoryPanel() lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -5578,7 +5578,7 @@ void Notepad_plus::launchFileSwitcherPanel() tTbData data = {0}; _pFileSwitcherPanel->create(&data); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pFileSwitcherPanel->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pFileSwitcherPanel->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_DOCSWITCHER_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5597,7 +5597,7 @@ void Notepad_plus::launchFileSwitcherPanel() lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -5619,7 +5619,7 @@ void Notepad_plus::launchAnsiCharPanel() tTbData data = {0}; _pAnsiCharPanel->create(&data); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pAnsiCharPanel->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pAnsiCharPanel->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_ASCIIPANEL_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5638,7 +5638,7 @@ void Notepad_plus::launchAnsiCharPanel() lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -5662,7 +5662,7 @@ void Notepad_plus::launchFileBrowser(const vector & folders) _pFileBrowser->create(&data); data.pszName = TEXT("ST"); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pFileBrowser->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pFileBrowser->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_FILEBROWSER_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5682,7 +5682,7 @@ void Notepad_plus::launchFileBrowser(const vector & folders) lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -5715,7 +5715,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int (*pProjPanel)->create(&data); data.pszName = TEXT("ST"); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)(*pProjPanel)->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast((*pProjPanel)->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_PROJECTPANEL_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5735,7 +5735,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -5763,7 +5763,7 @@ void Notepad_plus::launchDocMap() tTbData data = {0}; _pDocMap->create(&data); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pDocMap->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pDocMap->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_DOCMAP_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5782,7 +5782,7 @@ void Notepad_plus::launchDocMap() lstrcpy(title, title_temp.c_str()); data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); } _pDocMap->initWrapMap(); @@ -5803,7 +5803,7 @@ void Notepad_plus::launchFunctionList() tTbData data = {0}; _pFuncList->create(&data); - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pFuncList->getHSelf()); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pFuncList->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB; data.hIconTab = (HICON)::LoadImage(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDR_FUNC_LIST_ICO), IMAGE_ICON, 14, 14, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -5824,7 +5824,7 @@ void Notepad_plus::launchFunctionList() data.pszName = title; } - ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); COLORREF fgColor = (NppParameters::getInstance())->getCurrentDefaultFgColor(); COLORREF bgColor = (NppParameters::getInstance())->getCurrentDefaultBgColor(); @@ -6198,7 +6198,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params) if (currentBufID != targetBufID) return TRUE; - ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, (LPARAM)charToShow); + ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, reinterpret_cast(charToShow)); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); previousChar = text2display[i]; @@ -6213,7 +6213,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params) size_t pos = quoter_str.find("Anonymous"); if (pos == string::npos) { - ::SendMessage(curScintilla, SCI_APPENDTEXT, 3, (LPARAM)"\n- "); + ::SendMessage(curScintilla, SCI_APPENDTEXT, 3, reinterpret_cast("\n- ")); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); // Display quoter @@ -6229,7 +6229,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params) if (currentBufID != targetBufID) return TRUE; - ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, (LPARAM)charToShow); + ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, reinterpret_cast(charToShow)); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); } @@ -6267,7 +6267,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params) ReleaseMutex(textTrollerParams->_mutex); return TRUE; } - ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, (LPARAM)charToShow); + ::SendMessage(curScintilla, SCI_APPENDTEXT, 1, reinterpret_cast(charToShow)); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); } //writeLog(TEXT("c:\\tmp\\log.txt"), text2display); @@ -6594,7 +6594,7 @@ bool Notepad_plus::undoStreamComment() //-- Delete end stream-comment string --------- _pEditView->execute(SCI_BEGINUNDOACTION); _pEditView->execute(SCI_SETSEL, posEndComment, posEndComment + endCommentLength); - _pEditView->execute(SCI_REPLACESEL, 0, (WPARAM)""); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); //-- Get character after start-comment to decide, if there is a white character after the start-comment, which will be removed too! _pEditView->getGenericText(charbuf, charbufLen, posStartComment+startCommentLength, posStartComment+startCommentLength+1); @@ -6603,7 +6603,7 @@ bool Notepad_plus::undoStreamComment() //-- Delete starting stream-comment string --------- _pEditView->execute(SCI_SETSEL, posStartComment, posStartComment + startCommentLength); - _pEditView->execute(SCI_REPLACESEL, 0, (WPARAM)""); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); _pEditView->execute(SCI_ENDUNDOACTION); //-- Reset selection before calling the routine diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 908c081fc..322ac4caf 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -84,7 +84,7 @@ LRESULT CALLBACK Notepad_plus_Window::Notepad_plus_Proc(HWND hwnd, UINT Message, // then stock it into GWLP_USERDATA index in order to retrieve afterward Notepad_plus_Window *pM30ide = static_cast((reinterpret_cast(lParam))->lpCreateParams); pM30ide->_hSelf = hwnd; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pM30ide); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pM30ide)); return TRUE; } @@ -134,7 +134,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa case WM_NCACTIVATE: { // Note: lParam is -1 to prevent endless loops of calls - ::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1); + ::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, -1); return ::DefWindowProc(hwnd, Message, wParam, lParam); } @@ -927,7 +927,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa // get text of current scintilla auto length = pSci->execute(SCI_GETTEXTLENGTH, 0, 0) + 1; char* buffer = new char[length]; - pSci->execute(SCI_GETTEXT, length, (LPARAM)buffer); + pSci->execute(SCI_GETTEXT, length, reinterpret_cast(buffer)); // convert here UniMode unicodeMode = pSci->getCurrentBuffer()->getUnicodeMode(); @@ -965,7 +965,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa // get text of current scintilla auto length = pSci->execute(SCI_GETTEXTLENGTH, 0, 0) + 1; char* buffer = new char[length]; - pSci->execute(SCI_GETTEXT, length, (LPARAM)buffer); + pSci->execute(SCI_GETTEXT, length, reinterpret_cast(buffer)); Utf8_16_Read UnicodeConvertor; length = UnicodeConvertor.convert(buffer, length-1); @@ -1008,7 +1008,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf(); nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom); - ::SendMessage(hwnd, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + ::SendMessage(hwnd, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast(&nmhdr)); } return TRUE; } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 5fc6f4c73..ae9ed12ae 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -296,7 +296,7 @@ void Notepad_plus::command(int id) CloseClipboard(); if (id == IDM_EDIT_CUT_BINARY) - _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)""); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); } break; @@ -333,8 +333,8 @@ void Notepad_plus::command(int id) unsigned long *lpLen = (unsigned long *)GlobalLock(hglbLen); if (lpLen != NULL) { - _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)""); - _pEditView->execute(SCI_ADDTEXT, *lpLen, (LPARAM)lpchar); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); + _pEditView->execute(SCI_ADDTEXT, *lpLen, reinterpret_cast(lpchar)); GlobalUnlock(hglb); } @@ -343,7 +343,7 @@ void Notepad_plus::command(int id) else { - _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lpchar); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast(lpchar)); } GlobalUnlock(hglb); } @@ -374,7 +374,7 @@ void Notepad_plus::command(int id) // Call the application-defined ReplaceSelection // function to insert the text and repaint the // window. - _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lptstr); + _pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast(lptstr)); GlobalUnlock(hglb); } @@ -729,8 +729,8 @@ void Notepad_plus::command(int id) _mainEditView.execute(SCI_STOPRECORD); _subEditView.execute(SCI_STOPRECORD); - _mainEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL); - _subEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL); + _mainEditView.execute(SCI_SETCURSOR, static_cast(SC_CURSORNORMAL)); + _subEditView.execute(SCI_SETCURSOR, static_cast(SC_CURSORNORMAL)); _recordingMacro = false; _runMacroDlg.initMacroList(); @@ -1215,9 +1215,15 @@ void Notepad_plus::command(int id) case IDM_EDIT_SPLIT_LINES: _pEditView->execute(SCI_TARGETFROMSELECTION); if (_pEditView->execute(SCI_GETEDGEMODE) == EDGE_NONE) + { _pEditView->execute(SCI_LINESSPLIT); + } else - _pEditView->execute(SCI_LINESSPLIT, _pEditView->execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)"P") * _pEditView->execute(SCI_GETEDGECOLUMN)); + { + auto textWidth = _pEditView->execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast("P")); + auto edgeCol = _pEditView->execute(SCI_GETEDGECOLUMN); + _pEditView->execute(SCI_LINESSPLIT, textWidth * edgeCol); + } break; case IDM_EDIT_JOIN_LINES: @@ -1501,8 +1507,8 @@ void Notepad_plus::command(int id) if (hf) { - ::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); - ::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); + ::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, reinterpret_cast(hf), MAKELPARAM(TRUE, 0)); + ::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, reinterpret_cast(hf), MAKELPARAM(TRUE, 0)); } ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); @@ -1720,11 +1726,11 @@ void Notepad_plus::command(int id) if (_syncInfo._isSynScollH) { int mxoffset = static_cast(_mainEditView.execute(SCI_GETXOFFSET)); - int pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + int pixel = static_cast(_mainEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); int mainColumn = mxoffset/pixel; int sxoffset = static_cast(_subEditView.execute(SCI_GETXOFFSET)); - pixel = int(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, (LPARAM)"P")); + pixel = int(_subEditView.execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast("P"))); int subColumn = sxoffset/pixel; _syncInfo._column = mainColumn - subColumn; } diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 07d8c4ba0..a8cad2b96 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -91,7 +91,7 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params) { if (dwAction == FILE_ACTION_MODIFIED) { - ::PostMessage(h, NPPM_INTERNAL_RELOADSCROLLTOEND, (WPARAM)buf, 0); + ::PostMessage(h, NPPM_INTERNAL_RELOADSCROLLTOEND, reinterpret_cast(buf), 0); } else if ((dwAction == FILE_ACTION_REMOVED) || (dwAction == FILE_ACTION_RENAMED_OLD_NAME)) { @@ -670,8 +670,6 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup) // if the same buffer ID is not found then remove the entry from File Switcher Panel if (_pFileSwitcherPanel) { - //int posInfo = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_GETPOSFROMBUFFERID, (WPARAM)id ,0); - _pFileSwitcherPanel->closeItem(id, whichOne); if (hiddenBufferID != BUFFER_INVALID) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index bc78785ac..fdf302c86 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -211,8 +211,8 @@ BOOL Notepad_plus::notify(SCNotification *notification) } else { - ::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin); - ::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_pPublicInterface->getHinst(), (LPARAM)&fileNamesData); + ::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, reinterpret_cast(hWin)); + ::SendMessage(hWinParent, WM_COPYDATA, reinterpret_cast(_pPublicInterface->getHinst()), reinterpret_cast(&fileNamesData)); if (!isInCtrlStat) { fileClose(bufferToClose, iView); @@ -557,14 +557,14 @@ BOOL Notepad_plus::notify(SCNotification *notification) // Get entire document. auto length = notifyView->execute(SCI_GETLENGTH); buf = new char[length + 1]; - notifyView->execute(SCI_GETTEXT, (LPARAM)(length + 1), (WPARAM)buf); + notifyView->execute(SCI_GETTEXT, length + 1, reinterpret_cast(buf)); } else { // Get single line. auto length = notifyView->execute(SCI_GETCURLINE); buf = new char[length + 1]; - notifyView->execute(SCI_GETCURLINE, (WPARAM)length, (LPARAM)buf); + notifyView->execute(SCI_GETCURLINE, length, reinterpret_cast(buf)); // Compute the position of the click (relative to the beginning of the line). const auto line_position = notifyView->execute(SCI_POSITIONFROMLINE, notifyView->getCurrentLineNumber()); @@ -852,7 +852,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) case SCN_HOTSPOTDOUBLECLICK: { - notifyView->execute(SCI_SETWORDCHARS, 0, (LPARAM)"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+.,:?&@=/%#()"); + notifyView->execute(SCI_SETWORDCHARS, 0, reinterpret_cast("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+.,:?&@=/%#()")); auto pos = notifyView->execute(SCI_GETCURRENTPOS); int startPos = static_cast(notifyView->execute(SCI_WORDSTARTPOSITION, pos, false)); @@ -860,7 +860,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) notifyView->execute(SCI_SETTARGETRANGE, startPos, endPos); - int posFound = static_cast(notifyView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR)); + int posFound = static_cast(notifyView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), reinterpret_cast(URL_REG_EXPR))); if (posFound != -2) { if (posFound != -1) @@ -909,7 +909,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) case RBN_CHEVRONPUSHED: { - NMREBARCHEVRON * lpnm = (NMREBARCHEVRON*) notification; + NMREBARCHEVRON * lpnm = reinterpret_cast(notification); ReBar * notifRebar = &_rebarTop; if (_rebarBottom.getHSelf() == lpnm->hdr.hwndFrom) notifRebar = &_rebarBottom; @@ -931,8 +931,8 @@ BOOL Notepad_plus::notify(SCNotification *notification) rbBand.cbSize = REBARBAND_SIZE; rbBand.fMask = RBBIM_CHILD; - ::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, (LPARAM)&rbBand); - ::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, (LPARAM)lpnm); + ::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, reinterpret_cast(&rbBand)); + ::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, reinterpret_cast(lpnm)); break; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index d880cf12f..5fbdac00f 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1521,7 +1521,7 @@ void NppParameters::setFontList(HWND hWnd) lf.lfFaceName[0]='\0'; lf.lfPitchAndFamily = 0; HDC hDC = ::GetDC(hWnd); - ::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, (LPARAM)&_fontlist, 0); + ::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, reinterpret_cast(&_fontlist), 0); } bool NppParameters::isInFontList(const generic_string fontName2Search) const diff --git a/PowerEditor/src/ScitillaComponent/DocTabView.cpp b/PowerEditor/src/ScitillaComponent/DocTabView.cpp index c24959472..cdfc186e0 100644 --- a/PowerEditor/src/ScitillaComponent/DocTabView.cpp +++ b/PowerEditor/src/ScitillaComponent/DocTabView.cpp @@ -51,8 +51,8 @@ void DocTabView::addBuffer(BufferID buffer) if (_hasImgLst) index = 0; tie.iImage = index; - tie.pszText = (TCHAR *)buf->getFileName(); - tie.lParam = (LPARAM)buffer; + tie.pszText = const_cast(buf->getFileName()); + tie.lParam = reinterpret_cast(buffer); ::SendMessage(_hSelf, TCM_INSERTITEM, _nbItem++, reinterpret_cast(&tie)); bufferUpdated(buf, BufferChangeMask); @@ -161,7 +161,7 @@ void DocTabView::bufferUpdated(Buffer * buffer, int mask) if (mask & BufferChangeFilename) { tie.mask |= TCIF_TEXT; - tie.pszText = (TCHAR *)encodedLabel; + tie.pszText = const_cast(encodedLabel); { const TCHAR* in = buffer->getFileName(); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 069c95360..390b847e8 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -387,7 +387,7 @@ int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector(text)); strings.push_back(generic_string(text)); } return count; @@ -657,7 +657,7 @@ INT_PTR CALLBACK FindInFinderDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA FindersInfo findersInfo; findersInfo._pSourceFinder = _pFinder2Search; findersInfo._findOption = _options; - ::SendMessage(_hParent, WM_FINDALL_INCURRENTFINDER, (WPARAM)&findersInfo, 0); + ::SendMessage(_hParent, WM_FINDALL_INCURRENTFINDER, reinterpret_cast(&findersInfo), 0); return TRUE; } return FALSE; @@ -1948,7 +1948,7 @@ void FindReplaceDlg::findAllIn(InWhat op) tTbData data = {0}; _pFinder->create(&data, false); - ::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_pFinder->getHSelf()); + ::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast(_pFinder->getHSelf())); // define the default docking behaviour data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO; data.hIconTab = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), IMAGE_ICON, 0, 0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); @@ -1959,12 +1959,12 @@ void FindReplaceDlg::findAllIn(InWhat op) // the dlgDlg should be the index of funcItem where the current function pointer is // in this case is DOCKABLE_DEMO_INDEX data.dlgID = 0; - ::SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); + ::SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, reinterpret_cast(&data)); _pFinder->_scintView.init(_hInst, _pFinder->getHSelf()); // Subclass the ScintillaEditView for the Finder (Scintilla doesn't notify all key presses) - originalFinderProc = SetWindowLongPtr(_pFinder->_scintView.getHSelf(), GWLP_WNDPROC, (LONG_PTR)finderProc); + originalFinderProc = SetWindowLongPtr(_pFinder->_scintView.getHSelf(), GWLP_WNDPROC, reinterpret_cast(finderProc)); _pFinder->setFinderReadOnly(true); _pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8); @@ -2929,7 +2929,7 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case NPPM_INTERNAL_FINDINFINDERDLG: { - ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_FINDINFINDERDLG, (WPARAM)this, 0); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_FINDINFINDERDLG, reinterpret_cast(this), 0); return TRUE; } @@ -2937,10 +2937,8 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { if (_canBeVolatiled) { - ::SendMessage(::GetParent(_hParent), NPPM_DMMHIDE, 0, (LPARAM)_hSelf); + ::SendMessage(::GetParent(_hParent), NPPM_DMMHIDE, 0, reinterpret_cast(_hSelf)); setClosed(true); - - //::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REMOVEFINDER, (WPARAM)this, 0); } return TRUE; } @@ -3111,7 +3109,8 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR // if focus is on a some other control, return it to the edit field if (::GetFocus() != ::GetDlgItem(_hSelf, IDC_INCFINDTEXT)) { - ::PostMessage(_hSelf, WM_NEXTDLGCTL, (WPARAM)::GetDlgItem(_hSelf, IDC_INCFINDTEXT), TRUE); + HWND hFindTxt = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT); + ::PostMessage(_hSelf, WM_NEXTDLGCTL, reinterpret_cast(hFindTxt), TRUE); return TRUE; } // otherwise, repeat the search @@ -3172,7 +3171,7 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR if (updateCase && !isFound) { CharacterRange range = (*(_pFRDlg->_ppEditView))->getSelection(); - (*(_pFRDlg->_ppEditView))->execute(SCI_SETSEL, (WPARAM)-1, range.cpMin); + (*(_pFRDlg->_ppEditView))->execute(SCI_SETSEL, static_cast(-1), range.cpMin); } } @@ -3193,7 +3192,7 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR POINT pt = {0, 0}, ptOrig = {0, 0}; ::MapWindowPoints(_hSelf, hParent, &pt, 1); ::OffsetWindowOrgEx((HDC)wParam, pt.x, pt.y, &ptOrig); - LRESULT lResult = SendMessage(hParent, WM_ERASEBKGND,(WPARAM)winDC, 0); + LRESULT lResult = SendMessage(hParent, WM_ERASEBKGND, reinterpret_cast(winDC), 0); ::SetWindowOrgEx(winDC, ptOrig.x, ptOrig.y, NULL); return (BOOL)lResult; } @@ -3245,7 +3244,7 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted) // invalidate the editor rect ::InvalidateRect(hEditor, NULL, TRUE); - ::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, (LPARAM)findStatus[iStatus]); + ::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, reinterpret_cast(findStatus[iStatus])); } void FindIncrementDlg::addToRebar(ReBar * rebar) @@ -3382,8 +3381,8 @@ void Progress::setPercent(unsigned percent, const TCHAR *fileName) const { if (_hwnd) { - ::PostMessage(_hPBar, PBM_SETPOS, (WPARAM)percent, 0); - ::SendMessage(_hPText, WM_SETTEXT, 0, (LPARAM)fileName); + ::PostMessage(_hPBar, PBM_SETPOS, percent, 0); + ::SendMessage(_hPText, WM_SETTEXT, 0, reinterpret_cast(fileName)); } } @@ -3440,7 +3439,7 @@ int Progress::createProgressWindow() width - 10, 20, _hwnd, NULL, _hInst, NULL); HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); if (hf) - ::SendMessage(_hPText, WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); + ::SendMessage(_hPText, WM_SETFONT, reinterpret_cast(hf), MAKELPARAM(TRUE, 0)); _hPBar = ::CreateWindowEx(0, PROGRESS_CLASS, TEXT("Progress Bar"), WS_CHILD | WS_VISIBLE | PBS_SMOOTH, @@ -3454,7 +3453,7 @@ int Progress::createProgressWindow() cBTNwidth, cBTNheight, _hwnd, NULL, _hInst, NULL); if (hf) - ::SendMessage(_hBtn, WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); + ::SendMessage(_hBtn, WM_SETFONT, reinterpret_cast(hf), MAKELPARAM(TRUE, 0)); ::ShowWindow(_hwnd, SW_SHOWNORMAL); ::UpdateWindow(_hwnd); @@ -3542,8 +3541,8 @@ LRESULT APIENTRY Progress::wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM l { case WM_CREATE: { - Progress* pw =(Progress*)((LPCREATESTRUCT)lparam)->lpCreateParams; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pw); + Progress* pw = reinterpret_cast(reinterpret_cast(lparam)->lpCreateParams); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pw)); return 0; } @@ -3558,9 +3557,7 @@ LRESULT APIENTRY Progress::wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM l case WM_COMMAND: if (HIWORD(wparam) == BN_CLICKED) { - Progress* pw = - reinterpret_cast(static_cast - (::GetWindowLongPtr(hwnd, GWLP_USERDATA))); + Progress* pw = reinterpret_cast(static_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA))); ::ResetEvent(pw->_hActiveState); ::EnableWindow(pw->_hBtn, FALSE); pw->setInfo(TEXT("Cancelling operation, please wait...")); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index d752b64dc..95c62e8f6 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -311,7 +311,7 @@ public : // Show finder and set focus if (_pFinder) { - ::SendMessage(_hParent, NPPM_DMMSHOW, 0, (LPARAM)_pFinder->getHSelf()); + ::SendMessage(_hParent, NPPM_DMMSHOW, 0, reinterpret_cast(_pFinder->getHSelf())); _pFinder->_scintView.getFocus(); } }; @@ -376,7 +376,7 @@ private : void enableMarkFunc(); void setDefaultButton(int nID) { - SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L); + SendMessage(_hSelf, DM_SETDEFID, nID, 0L); }; void gotoCorrectTab() { @@ -413,7 +413,7 @@ public : virtual void display(bool toShow = true) const; void setSearchText(const TCHAR * txt2find, bool) { - ::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, (LPARAM)txt2find); + ::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, reinterpret_cast(txt2find)); }; void setFindStatus(FindStatus iStatus, int nbCounted); @@ -455,7 +455,7 @@ public: void setInfo(const TCHAR *info) const { if (_hwnd) - ::SendMessage(_hPText, WM_SETTEXT, 0, (LPARAM)info); + ::SendMessage(_hPText, WM_SETTEXT, 0, reinterpret_cast(info)); } void setPercent(unsigned percent, const TCHAR *fileName) const; diff --git a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp index a425a8887..ea02f2d08 100644 --- a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp @@ -68,20 +68,11 @@ INT_PTR CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) } } - // find hotspots - /* - NMHDR nmhdr; - nmhdr.code = SCN_PAINTED; - nmhdr.hwndFrom = _hSelf; - nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom); - ::SendMessage(_hParent, WM_NOTIFY, (WPARAM)LINKTRIGGERED, (LPARAM)&nmhdr); - */ - SCNotification notification = {}; notification.nmhdr.code = SCN_PAINTED; notification.nmhdr.hwndFrom = _hSelf; notification.nmhdr.idFrom = ::GetDlgCtrlID(_hSelf); - ::SendMessage(_hParent, WM_NOTIFY, (WPARAM)LINKTRIGGERED, (LPARAM)¬ification); + ::SendMessage(_hParent, WM_NOTIFY, LINKTRIGGERED, reinterpret_cast(¬ification)); (*_ppEditView)->getFocus(); return TRUE; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 7423acbe9..667554b57 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -213,9 +213,9 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) execute(SCI_SETMARGINMASKN, _SC_MARGE_SYBOLE, (1<(bookmark_xpm)); + execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESBEGIN, reinterpret_cast(acTop_xpm)); + execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESEND, reinterpret_cast(acBottom_xpm)); execute(SCI_SETMARGINSENSITIVEN, _SC_MARGE_FOLDER, true); execute(SCI_SETMARGINSENSITIVEN, _SC_MARGE_SYBOLE, true); @@ -406,18 +406,11 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa if (wParam == VK_PRIOR || wParam == VK_NEXT) { // find hotspots - /* - NMHDR nmhdr; - nmhdr.code = SCN_PAINTED; - nmhdr.hwndFrom = _hSelf; - nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom); - ::SendMessage(_hParent, WM_NOTIFY, (WPARAM)LINKTRIGGERED, (LPARAM)&nmhdr); - */ SCNotification notification = {}; notification.nmhdr.code = SCN_PAINTED; notification.nmhdr.hwndFrom = _hSelf; notification.nmhdr.idFrom = ::GetDlgCtrlID(_hSelf); - ::SendMessage(_hParent, WM_NOTIFY, (WPARAM)LINKTRIGGERED, (LPARAM)¬ification); + ::SendMessage(_hParent, WM_NOTIFY, LINKTRIGGERED, reinterpret_cast(¬ification)); } break; @@ -448,20 +441,20 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet) if (not _pParameter->isInFontList(styleToSet._fontName)) { - execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)DEFAULT_FONT_NAME); + execute(SCI_STYLESETFONT, styleID, reinterpret_cast(DEFAULT_FONT_NAME)); } else { const char * fontNameA = wmc->wchar2char(styleToSet._fontName, CP_UTF8); - execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)fontNameA); + execute(SCI_STYLESETFONT, styleID, reinterpret_cast(fontNameA)); } } int fontStyle = styleToSet._fontStyle; if (fontStyle != STYLE_NOT_USED) { - execute(SCI_STYLESETBOLD, (WPARAM)styleID, fontStyle & FONTSTYLE_BOLD); - execute(SCI_STYLESETITALIC, (WPARAM)styleID, fontStyle & FONTSTYLE_ITALIC); - execute(SCI_STYLESETUNDERLINE, (WPARAM)styleID, fontStyle & FONTSTYLE_UNDERLINE); + execute(SCI_STYLESETBOLD, styleID, fontStyle & FONTSTYLE_BOLD); + execute(SCI_STYLESETITALIC, styleID, fontStyle & FONTSTYLE_ITALIC); + execute(SCI_STYLESETUNDERLINE, styleID, fontStyle & FONTSTYLE_UNDERLINE); } if (styleToSet._fontSize > 0) @@ -602,7 +595,7 @@ void ScintillaEditView::setEmbeddedJSLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 1, (LPARAM)getCompleteKeywordList(keywordList, L_JS, LANG_INDEX_INSTR)); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(getCompleteKeywordList(keywordList, L_JS, LANG_INDEX_INSTR))); execute(SCI_STYLESETEOLFILLED, SCE_HJ_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENT, true); execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENTDOC, true); @@ -623,7 +616,7 @@ void ScintillaEditView::setJsonLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 0, (LPARAM)getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR)); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR))); execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, reinterpret_cast("fold.compact"), reinterpret_cast("0")); @@ -644,7 +637,7 @@ void ScintillaEditView::setEmbeddedPhpLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 4, (LPARAM)getCompleteKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR)); + execute(SCI_SETKEYWORDS, 4, reinterpret_cast(getCompleteKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR))); execute(SCI_STYLESETEOLFILLED, SCE_HPHP_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HPHP_COMMENT, true); @@ -662,7 +655,7 @@ void ScintillaEditView::setEmbeddedAspLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 2, (LPARAM)getCompleteKeywordList(keywordList, L_VB, LANG_INDEX_INSTR)); + execute(SCI_SETKEYWORDS, 2, reinterpret_cast(getCompleteKeywordList(keywordList, L_VB, LANG_INDEX_INSTR))); execute(SCI_STYLESETEOLFILLED, SCE_HBA_DEFAULT, true); } @@ -692,15 +685,15 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) } execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.isCaseIgnored", (LPARAM)(userLangContainer->_isCaseIgnored ? "1":"0")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.allowFoldOfComments", (LPARAM)(userLangContainer->_allowFoldOfComments ? "1":"0")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldCompact", (LPARAM)(userLangContainer->_foldCompact ? "1":"0")); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.isCaseIgnored"), reinterpret_cast(userLangContainer->_isCaseIgnored ? "1":"0")); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.allowFoldOfComments"), reinterpret_cast(userLangContainer->_allowFoldOfComments ? "1":"0")); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.foldCompact"), reinterpret_cast(userLangContainer->_foldCompact ? "1":"0")); char name[] = "userDefine.prefixKeywords0"; for (int i=0 ; i_isPrefix[i]?"1":"0")); + execute(SCI_SETPROPERTY, reinterpret_cast(name), reinterpret_cast(userLangContainer->_isPrefix[i] ? "1" : "0")); } for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i) @@ -710,7 +703,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) if (globalMappper().setLexerMapper.find(i) != globalMappper().setLexerMapper.end()) { - execute(SCI_SETPROPERTY, (WPARAM)globalMappper().setLexerMapper[i].c_str(), reinterpret_cast(keyWords_char)); + execute(SCI_SETPROPERTY, reinterpret_cast(globalMappper().setLexerMapper[i].c_str()), reinterpret_cast(keyWords_char)); } else // OPERATORS2, FOLDERS_IN_CODE2, FOLDERS_IN_COMMENT, KEYWORDS1-8 { @@ -770,17 +763,17 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) char nestingBuffer[] = "userDefine.nesting.00"; itoa(userLangContainer->_forcePureLC, intBuffer, 10); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.forcePureLC", reinterpret_cast(intBuffer)); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.forcePureLC"), reinterpret_cast(intBuffer)); itoa(userLangContainer->_decimalSeparator, intBuffer, 10); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.decimalSeparator", reinterpret_cast(intBuffer)); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.decimalSeparator"), reinterpret_cast(intBuffer)); // at the end (position SCE_USER_KWLIST_TOTAL) send id values itoa((int)userLangContainer->getName(), intBuffer, 10); // use numeric value of TCHAR pointer - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.udlName", reinterpret_cast(intBuffer)); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.udlName"), reinterpret_cast(intBuffer)); itoa((int)_currentBufferID, intBuffer, 10); // use numeric value of BufferID pointer - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.currentBufferID", reinterpret_cast(intBuffer)); + execute(SCI_SETPROPERTY, reinterpret_cast("userDefine.currentBufferID"), reinterpret_cast(intBuffer)); for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i) { @@ -791,7 +784,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) if (i < 10) itoa(i, (nestingBuffer+20), 10); else itoa(i, (nestingBuffer+19), 10); - execute(SCI_SETPROPERTY, (WPARAM)nestingBuffer, (LPARAM)(itoa(style._nesting, intBuffer, 10))); + execute(SCI_SETPROPERTY, reinterpret_cast(nestingBuffer), reinterpret_cast(itoa(style._nesting, intBuffer, 10))); setStyle(style); } @@ -805,7 +798,7 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc) WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const char *pName = wmc->wchar2char(name, CP_ACP); - execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)pName); + execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast(pName)); LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(name); if (pStyler) @@ -823,7 +816,7 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc) { keywordList = wstring2string(*(style._keywords), CP_ACP); } - execute(SCI_SETKEYWORDS, style._keywordClass, (LPARAM)getCompleteKeywordList(keywordList, typeDoc, style._keywordClass)); + execute(SCI_SETKEYWORDS, style._keywordClass, reinterpret_cast(getCompleteKeywordList(keywordList, typeDoc, style._keywordClass))); } } } @@ -843,7 +836,7 @@ void ScintillaEditView::setCppLexer(LangType langType) { WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP); - execute(SCI_SETKEYWORDS, 2, (LPARAM)doxygenKeyWords_char); + execute(SCI_SETKEYWORDS, 2, reinterpret_cast(doxygenKeyWords_char)); } } @@ -866,8 +859,8 @@ void ScintillaEditView::setCppLexer(LangType langType) } cppTypes = getCompleteKeywordList(keywordListType, langType, LANG_INDEX_TYPE); - execute(SCI_SETKEYWORDS, 0, (LPARAM)cppInstrs); - execute(SCI_SETKEYWORDS, 1, (LPARAM)cppTypes); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(cppInstrs)); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(cppTypes)); execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, reinterpret_cast("fold.compact"), reinterpret_cast("0")); @@ -892,7 +885,7 @@ void ScintillaEditView::setJsLexer() { WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP); - execute(SCI_SETKEYWORDS, 2, (LPARAM)doxygenKeyWords_char); + execute(SCI_SETKEYWORDS, 2, reinterpret_cast(doxygenKeyWords_char)); } const TCHAR *newLexerName = ScintillaEditView::langNames[L_JAVASCRIPT].lexerName; @@ -933,9 +926,9 @@ void ScintillaEditView::setJsLexer() } const char *jsInstrs2 = getCompleteKeywordList(keywordListInstruction2, L_JAVASCRIPT, LANG_INDEX_INSTR2); - execute(SCI_SETKEYWORDS, 0, (LPARAM)jsInstrs); - execute(SCI_SETKEYWORDS, 1, (LPARAM)jsTypes); - execute(SCI_SETKEYWORDS, 3, (LPARAM)jsInstrs2); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(jsInstrs)); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(jsTypes)); + execute(SCI_SETKEYWORDS, 3, reinterpret_cast(jsInstrs2)); } else // New js styler is not available, we use the old styling for the sake of retro-compatibility { @@ -981,7 +974,7 @@ void ScintillaEditView::setJsLexer() keywordListInstruction = wstring2string(kwlW, CP_ACP); } const char *jsEmbeddedInstrs = getCompleteKeywordList(keywordListInstruction, L_JS, LANG_INDEX_INSTR); - execute(SCI_SETKEYWORDS, 0, (LPARAM)jsEmbeddedInstrs); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(jsEmbeddedInstrs)); } execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); @@ -1023,8 +1016,8 @@ void ScintillaEditView::setTclLexer() } tclTypes = getCompleteKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE); - execute(SCI_SETKEYWORDS, 0, (LPARAM)tclInstrs); - execute(SCI_SETKEYWORDS, 1, (LPARAM)tclTypes); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(tclInstrs)); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(tclTypes)); } //used by Objective-C and Actionscript @@ -1075,11 +1068,11 @@ void ScintillaEditView::setObjCLexer(LangType langType) } const char *doxygenKeyWords = doxygenKeyWordsString.c_str(); - execute(SCI_SETKEYWORDS, 0, (LPARAM)objcInstrs); - execute(SCI_SETKEYWORDS, 1, (LPARAM)objcTypes); - execute(SCI_SETKEYWORDS, 2, (LPARAM)doxygenKeyWords); - execute(SCI_SETKEYWORDS, 3, (LPARAM)objCDirective); - execute(SCI_SETKEYWORDS, 4, (LPARAM)objCQualifier); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(objcInstrs)); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(objcTypes)); + execute(SCI_SETKEYWORDS, 2, reinterpret_cast(doxygenKeyWords)); + execute(SCI_SETKEYWORDS, 3, reinterpret_cast(objCDirective)); + execute(SCI_SETKEYWORDS, 4, reinterpret_cast(objCQualifier)); execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, reinterpret_cast("fold.compact"), reinterpret_cast("0")); @@ -1092,7 +1085,7 @@ void ScintillaEditView::setKeywords(LangType langType, const char *keywords, int { std::basic_string wordList; wordList = (keywords)?keywords:""; - execute(SCI_SETKEYWORDS, index, (LPARAM)getCompleteKeywordList(wordList, langType, index)); + execute(SCI_SETKEYWORDS, index, reinterpret_cast(getCompleteKeywordList(wordList, langType, index))); } void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList) @@ -1800,7 +1793,7 @@ void ScintillaEditView::fold(size_t line, bool mode) scnN.line = headerLine; scnN.foldLevelNow = isFolded(headerLine)?1:0; //folded:1, unfolded:0 - ::SendMessage(_hParent, WM_NOTIFY, 0, (LPARAM)&scnN); + ::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast(&scnN)); } } @@ -1867,12 +1860,12 @@ void ScintillaEditView::insertGenericTextFrom(size_t position, const TCHAR *text WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *text2insertA = wmc->wchar2char(text2insert, cp); - execute(SCI_INSERTTEXT, position, (WPARAM)text2insertA); + execute(SCI_INSERTTEXT, position, reinterpret_cast(text2insertA)); } void ScintillaEditView::replaceSelWith(const char * replaceText) { - execute(SCI_REPLACESEL, 0, (WPARAM)replaceText); + execute(SCI_REPLACESEL, 0, reinterpret_cast(replaceText)); } void ScintillaEditView::getVisibleStartAndEndPosition(int * startPos, int * endPos) @@ -1969,7 +1962,7 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2 const char *text2FindA = wmc->wchar2char(text2Find, cp); size_t text2FindALen = strlen(text2FindA); size_t len = (lenOfText2Find > text2FindALen) ? lenOfText2Find : text2FindALen; - return static_cast(execute(SCI_SEARCHINTARGET, (WPARAM)len, (LPARAM)text2FindA)); + return static_cast(execute(SCI_SEARCHINTARGET, len, reinterpret_cast(text2FindA))); } void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const @@ -1977,7 +1970,7 @@ void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *text2AppendA =wmc->wchar2char(text2Append, cp); - execute(SCI_APPENDTEXT, strlen(text2AppendA), (LPARAM)text2AppendA); + execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } void ScintillaEditView::addGenericText(const TCHAR * text2Append) const @@ -1985,7 +1978,7 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append) const WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *text2AppendA =wmc->wchar2char(text2Append, cp); - execute(SCI_ADDTEXT, strlen(text2AppendA), (LPARAM)text2AppendA); + execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const @@ -1993,7 +1986,7 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *text2AppendA =wmc->wchar2char(text2Append, cp, mstart, mend); - execute(SCI_ADDTEXT, strlen(text2AppendA), (LPARAM)text2AppendA); + execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } int32_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTargetPos, int toTargetPos) const @@ -2005,7 +1998,7 @@ int32_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTarg WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *str2replaceA = wmc->wchar2char(str2replace, cp); - return static_cast(execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)str2replaceA)); + return static_cast(execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(str2replaceA))); } int ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, int fromTargetPos, int toTargetPos) const @@ -2017,7 +2010,7 @@ int ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, int fromTargetPo WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *reA = wmc->wchar2char(re, cp); - return static_cast(execute(SCI_REPLACETARGETRE, (WPARAM)-1, (LPARAM)reA)); + return static_cast(execute(SCI_REPLACETARGETRE, static_cast(-1), reinterpret_cast(reA))); } void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list) @@ -2025,7 +2018,7 @@ void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list) WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *listA = wmc->wchar2char(list, cp); - execute(SCI_AUTOCSHOW, lenEntered, WPARAM(listA)); + execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast(listA)); } void ScintillaEditView::showCallTip(int startPos, const TCHAR * def) @@ -2033,7 +2026,7 @@ void ScintillaEditView::showCallTip(int startPos, const TCHAR * def) WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *defA = wmc->wchar2char(def, cp); - execute(SCI_CALLTIPSHOW, startPos, LPARAM(defA)); + execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast(defA)); } generic_string ScintillaEditView::getLine(size_t lineNumber) @@ -2052,7 +2045,7 @@ void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, int lineBufferL char *lineA = new char[lineBufferLen]; // From Scintilla documentation for SCI_GETLINE: "The buffer is not terminated by a 0 character." memset(lineA, 0x0, sizeof(char) * lineBufferLen); - execute(SCI_GETLINE, lineNumber, (LPARAM)lineA); + execute(SCI_GETLINE, lineNumber, reinterpret_cast(lineA)); const TCHAR *lineW = wmc->char2wchar(lineA, cp); lstrcpyn(line, lineW, lineBufferLen); delete [] lineA; @@ -2060,7 +2053,7 @@ void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, int lineBufferL void ScintillaEditView::addText(size_t length, const char *buf) { - execute(SCI_ADDTEXT, length, (LPARAM)buf); + execute(SCI_ADDTEXT, length, reinterpret_cast(buf)); } void ScintillaEditView::beginOrEndSelect() @@ -2071,7 +2064,7 @@ void ScintillaEditView::beginOrEndSelect() } else { - execute(SCI_SETANCHOR, (WPARAM)_beginSelectPosition); + execute(SCI_SETANCHOR, _beginSelectPosition); _beginSelectPosition = -1; } } @@ -2331,7 +2324,7 @@ void ScintillaEditView::updateLineNumberWidth() } i = max(i, 3); - auto pixelWidth = 8 + i * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)"8"); + auto pixelWidth = 8 + i * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast("8")); execute(SCI_SETMARGINWIDTHN, _SC_MARGE_LINENUMBER, pixelWidth); } } @@ -2551,7 +2544,7 @@ void ScintillaEditView::convertSelectedTextTo(const TextCase & caseToConvert) ::WideCharToMultiByte(codepage, 0, destStr, len, srcStr, len, NULL, NULL); execute(SCI_SETTARGETRANGE, start, end); - execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)srcStr); + execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(srcStr)); delete [] srcStr; delete [] destStr; @@ -2559,9 +2552,6 @@ void ScintillaEditView::convertSelectedTextTo(const TextCase & caseToConvert) setMultiSelections(cmi); - //execute(SCI_SETSELECTIONSTART, selStart); - //execute(SCI_SETSELECTIONEND, selEnd); - execute(SCI_ENDUNDOACTION); return; } @@ -2577,7 +2567,7 @@ void ScintillaEditView::convertSelectedTextTo(const TextCase & caseToConvert) int strWSize = strSize * 2; wchar_t *selectedStrW = new wchar_t[strWSize+3]; - execute(SCI_GETSELTEXT, 0, (LPARAM)selectedStr); + execute(SCI_GETSELTEXT, 0, reinterpret_cast(selectedStr)); int nbChar = ::MultiByteToWideChar(codepage, 0, selectedStr, strSize, selectedStrW, strWSize); @@ -2586,7 +2576,7 @@ void ScintillaEditView::convertSelectedTextTo(const TextCase & caseToConvert) ::WideCharToMultiByte(codepage, 0, selectedStrW, strWSize, selectedStr, strSize, NULL, NULL); execute(SCI_SETTARGETRANGE, selectionStart, selectionEnd); - execute(SCI_REPLACETARGET, strLen, (LPARAM)selectedStr); + execute(SCI_REPLACETARGET, strLen, reinterpret_cast(selectedStr)); execute(SCI_SETSEL, selectionStart, selectionEnd); delete [] selectedStr; delete [] selectedStrW; @@ -2720,7 +2710,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) { for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; ++j, ++k) { - execute(SCI_INSERTTEXT, k, (LPARAM)" "); + execute(SCI_INSERTTEXT, k, reinterpret_cast(" ")); } cmi[i]._selLpos += cmi[i]._nbVirtualAnchorSpc; cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc; @@ -2731,7 +2721,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *strA = wmc->wchar2char(str, cp); - execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)strA); + execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(strA)); if (hasVirtualSpc) { @@ -2823,7 +2813,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in { for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; ++j, ++k) { - execute(SCI_INSERTTEXT, k, (LPARAM)" "); + execute(SCI_INSERTTEXT, k, reinterpret_cast(" ")); } cmi[i]._selLpos += cmi[i]._nbVirtualAnchorSpc; cmi[i]._selRpos += cmi[i]._nbVirtualCaretSpc; @@ -2833,7 +2823,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); const char *strA = wmc->wchar2char(str, cp); - execute(SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)strA); + execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(strA)); if (hasVirtualSpc) { diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index c3496c015..b68ddaa5d 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -377,7 +377,7 @@ public: }; void showIndentGuideLine(bool willBeShowed = true) { - execute(SCI_SETINDENTATIONGUIDES, (WPARAM)willBeShowed?(SC_IV_LOOKBOTH):(SC_IV_NONE)); + execute(SCI_SETINDENTATIONGUIDES, willBeShowed ? SC_IV_LOOKBOTH : SC_IV_NONE); }; bool isShownIndentGuide() const { @@ -385,7 +385,7 @@ public: }; void wrap(bool willBeWrapped = true) { - execute(SCI_SETWRAPMODE, (WPARAM)willBeWrapped); + execute(SCI_SETWRAPMODE, willBeWrapped); }; bool isWrap() const { @@ -467,7 +467,7 @@ public: return -1; auto size_selected = execute(SCI_GETSELTEXT); char *selected = new char[size_selected + 1]; - execute(SCI_GETSELTEXT, (WPARAM)0, (LPARAM)selected); + execute(SCI_GETSELTEXT, 0, reinterpret_cast(selected)); char *c = selected; long length = 0; while(*c != '\0') @@ -716,7 +716,7 @@ protected: void setSqlLexer() { const bool kbBackSlash = NppParameters::getInstance()->getNppGUI()._backSlashIsEscapeCharacterForSql; - execute(SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", kbBackSlash ? (LPARAM)"1" : (LPARAM)"0"); + execute(SCI_SETPROPERTY, reinterpret_cast("sql.backslash.escapes"), reinterpret_cast(kbBackSlash ? "1" : "0")); setLexer(SCLEX_SQL, L_SQL, LIST_0); }; diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index abf1611a3..c73db2916 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -164,15 +164,15 @@ void FolderStyleDialog::updateDlg() { ::SendDlgItemMessage(_hSelf, IDC_FOLDER_FOLD_COMPACT, BM_SETCHECK, _pUserLang->_foldCompact, 0); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_OPEN_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_MIDDLE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_CLOSE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_OPEN_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_MIDDLE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_CLOSE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_OPEN_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE])); } void FolderStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const @@ -372,14 +372,14 @@ void KeyWordsStyleDialog::setKeywords2List(int id) void KeyWordsStyleDialog::updateDlg() { - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS1])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS2])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS3])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS4])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD5_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS5])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD6_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS6])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD7_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS7])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD8_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS8])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS1])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS2])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS3])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS4])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD5_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS5])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD6_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS6])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD7_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS7])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD8_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS8])); ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[0], 0); ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[1], 0); @@ -628,7 +628,7 @@ void CommentStyleDialog::updateDlg() { generic_itoa(i, intBuffer+1, 10); retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer); - ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, reinterpret_cast(buffer)); } ::SendDlgItemMessage(_hSelf, IDC_FOLDING_OF_COMMENTS, BM_SETCHECK, _pUserLang->_allowFoldOfComments, 0); @@ -641,13 +641,13 @@ void CommentStyleDialog::updateDlg() ::SendDlgItemMessage(_hSelf, IDC_COMMA_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_COMMA, 0); ::SendDlgItemMessage(_hSelf, IDC_BOTH_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_BOTH, 0); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX1])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX2])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS1])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS2])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX1])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX2])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_RANGE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_RANGE])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX1_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX2_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS1_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS2_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX1_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX2_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_RANGE_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_RANGE])); } void SymbolsStyleDialog::updateDlg() @@ -681,7 +681,7 @@ void SymbolsStyleDialog::updateDlg() }; TCHAR intBuffer[10] = {'0', 0}; - for (int i=0; i_keywordLists[SCE_USER_KWLIST_DELIMITERS], intBuffer); - ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, reinterpret_cast(buffer)); } - ::SendDlgItemMessage(_hSelf, IDC_OPERATOR1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS1])); - ::SendDlgItemMessage(_hSelf, IDC_OPERATOR2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS2])); + ::SendDlgItemMessage(_hSelf, IDC_OPERATOR1_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS1])); + ::SendDlgItemMessage(_hSelf, IDC_OPERATOR2_EDIT, WM_SETTEXT, 0, reinterpret_cast(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS2])); } INT_PTR CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) @@ -977,11 +977,11 @@ void UserDefineDialog::reloadLangCombo() { NppParameters *pNppParam = NppParameters::getInstance(); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language")); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("User Define Language"))); for (int i = 0, nb = pNppParam->getNbUserLang(); i < nb ; ++i) { UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName()); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast(userLangContainer.getName())); } } @@ -1161,7 +1161,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR if (HIWORD(wParam) == EN_CHANGE) { TCHAR ext[extsLenMax]; - ::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)ext); + ::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, reinterpret_cast(ext)); _pUserLang->_ext = ext; return TRUE; } @@ -1228,12 +1228,12 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR { auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); TCHAR langName[256]; - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast(langName)); //remove current language from combobox ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i-1, 0); - ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); + ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), reinterpret_cast(::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO))); //remove current language from userLangArray pNppParam->removeUserLang(i-1); @@ -1244,7 +1244,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR HMENU subMenu = ::GetSubMenu(m, MENUINDEX_LANGUAGE); ::RemoveMenu(subMenu, IDM_LANG_USER + UINT(i), MF_BYCOMMAND); ::DrawMenuBar(hNpp); - ::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, (LPARAM)langName); + ::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, reinterpret_cast(langName)); } return TRUE; } @@ -1252,7 +1252,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR { TCHAR langName[256]; auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast(langName)); StringDlg strDlg; strDlg.init(_hInst, _hSelf, TEXT("Rename Current Language Name"), TEXT("Name : "), langName, langNameLenMax-1); @@ -1269,7 +1269,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR } //rename current language name in combobox ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_INSERTSTRING, i, (LPARAM)newName); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_INSERTSTRING, i, reinterpret_cast(newName)); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0); //rename current language name in userLangArray @@ -1278,9 +1278,11 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR //rename current language name in langMenu HWND hNpp = ::GetParent(_hSelf); - ::ModifyMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + UINT(i), MF_BYCOMMAND, IDM_LANG_USER + i, newName); + HMENU hM = reinterpret_cast(::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0)); + HMENU hSubM = ::GetSubMenu(hM, MENUINDEX_LANGUAGE); + ::ModifyMenu(hSubM, static_cast(IDM_LANG_USER + i), MF_BYCOMMAND, IDM_LANG_USER + i, newName); ::DrawMenuBar(hNpp); - ::SendMessage(_hParent, WM_RENAME_USERLANG, (WPARAM)newName, (LPARAM)langName); + ::SendMessage(_hParent, WM_RENAME_USERLANG, reinterpret_cast(newName), reinterpret_cast(langName)); } return TRUE; @@ -1289,9 +1291,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR case IDC_ADDNEW_BUTTON : case IDC_SAVEAS_BUTTON : { - //TCHAR langName[256]; auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - //::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); if (i == 0) wParam = IDC_ADDNEW_BUTTON; @@ -1302,7 +1302,6 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR strDlg.init(_hInst, _hSelf, TEXT("Create New Language..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); TCHAR *tmpName = (TCHAR *)strDlg.doDialog(); - //const TCHAR *newName = newNameString.c_str(); if (tmpName && tmpName[0]) { @@ -1322,11 +1321,11 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR //add new language name in combobox ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, LPARAM(newName)); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, newIndex + 1, 0); - ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); + ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), reinterpret_cast(::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO))); //add new language name in langMenu HWND hNpp = ::GetParent(_hSelf); - ::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex /*+ 1*/, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName); + ::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName); ::DrawMenuBar(hNpp); } @@ -1663,7 +1662,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR TCHAR intStr[5]; if (i != 0) { - ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, (LPARAM)intStr); + ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, reinterpret_cast(intStr)); if ((!intStr) || (!intStr[0])) style._fontSize = -1; else diff --git a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp index 3baf601c4..e64b62b3d 100644 --- a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp @@ -120,10 +120,10 @@ void URLCtrl::create(HWND itemHandle, TCHAR * link, COLORREF linkColor) _visitedColor = RGB(128,0,128); // subclass the static control - _oldproc = (WNDPROC)::SetWindowLongPtr(itemHandle, GWLP_WNDPROC, (LONG_PTR)URLCtrlProc); + _oldproc = reinterpret_cast(::SetWindowLongPtr(itemHandle, GWLP_WNDPROC, reinterpret_cast(URLCtrlProc))); // associate the URL structure with the static control - ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, reinterpret_cast(this)); // save hwnd _hSelf = itemHandle; @@ -140,10 +140,10 @@ void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest) _linkColor = RGB(0,0,255); // subclass the static control - _oldproc = (WNDPROC)::SetWindowLongPtr(itemHandle, GWLP_WNDPROC, (LONG_PTR)URLCtrlProc); + _oldproc = reinterpret_cast(::SetWindowLongPtr(itemHandle, GWLP_WNDPROC, reinterpret_cast(URLCtrlProc))); // associate the URL structure with the static control - ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, reinterpret_cast(this)); // save hwnd _hSelf = itemHandle; diff --git a/PowerEditor/src/WinControls/AnsiCharPanel/ListView.cpp b/PowerEditor/src/WinControls/AnsiCharPanel/ListView.cpp index 963537c46..81930ba86 100644 --- a/PowerEditor/src/WinControls/AnsiCharPanel/ListView.cpp +++ b/PowerEditor/src/WinControls/AnsiCharPanel/ListView.cpp @@ -63,7 +63,7 @@ void ListView::init(HINSTANCE hInst, HWND parent) throw std::runtime_error("ListView::init : CreateWindowEx() function return null"); } - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _defaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticProc))); DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf); @@ -79,15 +79,15 @@ void ListView::init(HINSTANCE hInst, HWND parent) generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar"); lvColumn.cx = NppParameters::getInstance()->_dpiManager.scaleX(45); - lvColumn.pszText = (TCHAR *)valStr.c_str(); + lvColumn.pszText = const_cast(valStr.c_str()); ListView_InsertColumn(_hSelf, 0, &lvColumn); lvColumn.cx = NppParameters::getInstance()->_dpiManager.scaleY(45);; - lvColumn.pszText = (TCHAR *)hexStr.c_str(); + lvColumn.pszText = const_cast(hexStr.c_str()); ListView_InsertColumn(_hSelf, 1, &lvColumn); lvColumn.cx = NppParameters::getInstance()->_dpiManager.scaleY(70);; - lvColumn.pszText = (TCHAR *)charStr.c_str(); + lvColumn.pszText = const_cast(charStr.c_str()); ListView_InsertColumn(_hSelf, 2, &lvColumn); } diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp index 7301ebadc..0e0c43aa0 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp @@ -47,8 +47,8 @@ void ColourPicker::init(HINSTANCE hInst, HWND parent) if (!_hSelf) throw std::runtime_error("ColourPicker::init : CreateWindowEx() function return null"); - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); - _buttonDefaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticWinProc)); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); + _buttonDefaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticWinProc))); } diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 1e8b9c130..949588291 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -470,11 +470,11 @@ void WordStyleDlg::loadLangListFromNppParam() // Clean up Language List ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles")); + ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, reinterpret_cast(TEXT("Global Styles"))); // All the lexers for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; ++i) { - ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i)); + ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, reinterpret_cast(_lsArray.getLexerDescFromIndex(i))); } const int index2Begin = 0; @@ -495,7 +495,7 @@ int WordStyleDlg::whichTabColourIndex() if (i == LB_ERR) return -1; TCHAR styleName[128]; - ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName)); if (lstrcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0) return TabBarPlus::activeFocusedTop; @@ -541,7 +541,7 @@ void WordStyleDlg::updateFontSize() TCHAR intStr[5]; if (iFontSizeSel != 0) { - ::SendMessage(_hFontSizeCombo, CB_GETLBTEXT, iFontSizeSel, (LPARAM)intStr); + ::SendMessage(_hFontSizeCombo, CB_GETLBTEXT, iFontSizeSel, reinterpret_cast(intStr)); if (!intStr[0]) style._fontSize = STYLE_NOT_USED; else @@ -560,7 +560,7 @@ void WordStyleDlg::updateExtension() { const int NB_MAX = 256; TCHAR ext[NB_MAX]; - ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, (LPARAM)ext); + ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, reinterpret_cast(ext)); _lsArray.getLexerFromIndex(_currentLexerIndex - 1).setLexerUserExt(ext); } @@ -572,7 +572,7 @@ void WordStyleDlg::updateUserKeywords() auto len = ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXTLENGTH, 0, 0); len += 1; TCHAR *kw = new TCHAR[len]; - ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXT, len, (LPARAM)kw); + ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXT, len, reinterpret_cast(kw)); style.setKeywords(kw); delete [] kw; @@ -663,7 +663,7 @@ void WordStyleDlg::setStyleListFromLexer(int index) const TCHAR *langName = _lsArray.getLexerNameFromIndex(index - 1); const TCHAR *ext = NppParameters::getInstance()->getLangExtFromName(langName); const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt(); - ::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(ext)); + ::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, reinterpret_cast(ext)); // WM_SETTEXT cause sending WM_COMMAND message with EN_CHANGE. // That makes status dirty, even it shouldn't in this case. @@ -671,7 +671,7 @@ void WordStyleDlg::setStyleListFromLexer(int index) // then restore the status after sending this message. bool isDirty = _isDirty; bool isThemeDirty = _isThemeDirty; - ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(userExt)); + ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, reinterpret_cast(userExt)); _isDirty = isDirty; _isThemeDirty = isThemeDirty; ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), isDirty || isThemeDirty); @@ -687,7 +687,7 @@ void WordStyleDlg::setStyleListFromLexer(int index) for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; ++i) { Style & style = lexerStyler.getStyler(i); - ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc); + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, reinterpret_cast(style._styleDesc)); } ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, 0, 0); setVisualFromStyleList(); @@ -716,13 +716,13 @@ void WordStyleDlg::setVisualFromStyleList() auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0); if (i == LB_ERR) return; - ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, (LPARAM)str); + ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, reinterpret_cast(str)); i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); if (i == LB_ERR) return; TCHAR styleName[64]; - ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName)); lstrcat(lstrcat(str, TEXT(" : ")), styleName); @@ -755,7 +755,7 @@ void WordStyleDlg::setVisualFromStyleList() LRESULT iFontName; if (style._fontName != NULL) { - iFontName = ::SendMessage(_hFontNameCombo, CB_FINDSTRING, 1, (LPARAM)style._fontName); + iFontName = ::SendMessage(_hFontNameCombo, CB_FINDSTRING, 1, reinterpret_cast(style._fontName)); if (iFontName == CB_ERR) iFontName = 0; isEnable = true; @@ -774,7 +774,7 @@ void WordStyleDlg::setVisualFromStyleList() if (style._fontSize != STYLE_NOT_USED) { wsprintf(intStr, TEXT("%d"), style._fontSize); - iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, (LPARAM)intStr); + iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, reinterpret_cast(intStr)); isEnable = true; } ::SendMessage(_hFontSizeCombo, CB_SETCURSEL, iFontSize, 0); @@ -819,10 +819,10 @@ void WordStyleDlg::setVisualFromStyleList() const TCHAR *kws = pNppParams->getWordList(lType, style._keywordClass); if (!kws) kws = TEXT(""); - ::SendDlgItemMessage(_hSelf, IDC_DEF_KEYWORDS_EDIT, WM_SETTEXT, 0, (LPARAM)(kws)); + ::SendDlgItemMessage(_hSelf, IDC_DEF_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast(kws)); const TCHAR *ckwStr = (style._keywords)?style._keywords->c_str():TEXT(""); - ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_SETTEXT, 0, (LPARAM)(ckwStr)); + ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast(ckwStr)); } int showOption = shouldBeDisplayed?SW_SHOW:SW_HIDE; diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 6b4c1ba77..2123cc384 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -52,8 +52,8 @@ public : return oldColour; }; void hookOn(HWND staticHandle) { - ::SetWindowLongPtr(staticHandle, GWLP_USERDATA, (LONG_PTR)this); - _oldProc = (WNDPROC)::SetWindowLongPtr(staticHandle, GWLP_WNDPROC, (LONG_PTR)staticProc); + ::SetWindowLongPtr(staticHandle, GWLP_USERDATA, reinterpret_cast(this)); + _oldProc = reinterpret_cast(::SetWindowLongPtr(staticHandle, GWLP_WNDPROC, reinterpret_cast(staticProc))); }; private : COLORREF _colour; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index a2161ee80..02f0b8b60 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -656,7 +656,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); - iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info)); + iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, reinterpret_cast(&info))); SelectTab(iItem); _beginDrag = FALSE; @@ -676,13 +676,13 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); - iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info)); + iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, reinterpret_cast(&info))); SelectTab(iItem); // get data and hide toolbar tcItem.mask = TCIF_PARAM; - ::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem); + ::SendMessage(hwnd, TCM_GETITEM, iItem, reinterpret_cast(&tcItem)); if (!tcItem.lParam) return FALSE; @@ -703,7 +703,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); - iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info)); + iItem = static_cast(::SendMessage(hwnd, TCM_HITTEST, 0, reinterpret_cast(&info))); if ((_beginDrag == TRUE) && (wParam == MK_LBUTTON)) { @@ -870,7 +870,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct) if (((tTbData*)tcItem.lParam)->uMask & DWS_ICONTAB) { HIMAGELIST hImageList = (HIMAGELIST)::SendMessage(_hParent, DMM_GETIMAGELIST, 0, 0); - int iPosImage = static_cast(::SendMessage(_hParent, DMM_GETICONPOS, 0, (LPARAM)((tTbData*)tcItem.lParam)->hClient)); + int iPosImage = static_cast(::SendMessage(_hParent, DMM_GETICONPOS, 0, reinterpret_cast(reinterpret_cast(tcItem.lParam)->hClient))); if ((hImageList != NULL) && (iPosImage >= 0)) { @@ -927,12 +927,12 @@ INT_PTR CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP _hCaption = ::GetDlgItem(_hSelf, IDC_BTN_CAPTION); // intial subclassing of caption - ::SetWindowLongPtr(_hCaption, GWLP_USERDATA, (LONG_PTR)this); - _hDefaultCaptionProc = reinterpret_cast(::SetWindowLongPtr(_hCaption, GWLP_WNDPROC, (LONG_PTR)wndCaptionProc)); + ::SetWindowLongPtr(_hCaption, GWLP_USERDATA, reinterpret_cast(this)); + _hDefaultCaptionProc = reinterpret_cast(::SetWindowLongPtr(_hCaption, GWLP_WNDPROC, reinterpret_cast(wndCaptionProc))); // intial subclassing of tab - ::SetWindowLongPtr(_hContTab, GWLP_USERDATA, (LONG_PTR)this); - _hDefaultTabProc = reinterpret_cast(::SetWindowLongPtr(_hContTab, GWLP_WNDPROC, (LONG_PTR)wndTabProc)); + ::SetWindowLongPtr(_hContTab, GWLP_USERDATA, reinterpret_cast(this)); + _hDefaultTabProc = reinterpret_cast(::SetWindowLongPtr(_hContTab, GWLP_WNDPROC, reinterpret_cast(wndTabProc))); // set min tab width int tabDpiDynamicalMinWidth = NppParameters::getInstance()->_dpiManager.scaleY(24); @@ -949,9 +949,9 @@ INT_PTR CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP case WM_DRAWITEM : { // draw tab or caption - if (((DRAWITEMSTRUCT *)lParam)->CtlID == IDC_TAB_CONT) + if (reinterpret_cast(lParam)->CtlID == IDC_TAB_CONT) { - drawTabItem((DRAWITEMSTRUCT *)lParam); + drawTabItem(reinterpret_cast(lParam)); return TRUE; } else @@ -1117,7 +1117,7 @@ void DockingCont::onSize() for (size_t iItem = 0; iItem < iItemCnt; ++iItem) { tcItem.mask = TCIF_PARAM; - ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast(&tcItem)); if (!tcItem.lParam) continue; @@ -1130,7 +1130,7 @@ void DockingCont::onSize() nmhdr.code = DMN_FLOATDROPPED; nmhdr.hwndFrom = _hSelf; nmhdr.idFrom = 0; - ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast(&nmhdr)); } } @@ -1148,7 +1148,7 @@ void DockingCont::doClose() // get item data SelectTab(iItemOff); tcItem.mask = TCIF_PARAM; - ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, reinterpret_cast(&tcItem)); if (!tcItem.lParam) continue; @@ -1258,7 +1258,7 @@ void DockingCont::viewToolbar(tTbData *pTbData) // create new tab if it not exists int iTabPos = SearchPosInTab(pTbData); tcItem.mask = TCIF_PARAM; - tcItem.lParam = (LPARAM)pTbData; + tcItem.lParam = reinterpret_cast(pTbData); if (iTabPos == -1) { @@ -1293,7 +1293,7 @@ int DockingCont::SearchPosInTab(tTbData* pTbData) for (int iItem = 0; iItem < iItemCnt; ++iItem) { - ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast(&tcItem)); if (!tcItem.lParam) continue; @@ -1315,7 +1315,7 @@ void DockingCont::SelectTab(int iTab) // get data of new active dialog tcItem.mask = TCIF_PARAM; - ::SendMessage(_hContTab, TCM_GETITEM, iTab, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, iTab, reinterpret_cast(&tcItem)); // show active dialog if (!tcItem.lParam) return; @@ -1328,12 +1328,12 @@ void DockingCont::SelectTab(int iTab) nmhdr.code = DMN_SWITCHIN; nmhdr.hwndFrom = _hSelf; nmhdr.idFrom = 0; - ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + ::SendMessage(reinterpret_cast(tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast(&nmhdr)); if (static_cast(iTab) != _prevItem) { // hide previous dialog - ::SendMessage(_hContTab, TCM_GETITEM, _prevItem, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, _prevItem, reinterpret_cast(&tcItem)); if (!tcItem.lParam) return; @@ -1344,7 +1344,7 @@ void DockingCont::SelectTab(int iTab) nmhdr.code = DMN_SWITCHOFF; nmhdr.hwndFrom = _hSelf; nmhdr.idFrom = 0; - ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + ::SendMessage(((tTbData*)tcItem.lParam)->hClient, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast(&nmhdr)); } // resize tab item @@ -1357,10 +1357,10 @@ void DockingCont::SelectTab(int iTab) { const TCHAR *pszTabTxt = NULL; - ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); + ::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast(&tcItem)); if (!tcItem.lParam) continue; - pszTabTxt = ((tTbData*)tcItem.lParam)->pszName; + pszTabTxt = reinterpret_cast(tcItem.lParam)->pszName; // get current font width GetTextExtentPoint32(hDc, pszTabTxt, lstrlen(pszTabTxt), &size); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index ffe504acf..953c41fcb 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -187,13 +187,13 @@ LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM w switch (message) { case WM_NCCREATE : - pDockingManager = (DockingManager *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + pDockingManager = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); pDockingManager->_hSelf = hwnd; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pDockingManager); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pDockingManager)); return TRUE; default : - pDockingManager = (DockingManager *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); + pDockingManager = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); if (!pDockingManager) return ::DefWindowProc(hwnd, message, wParam, lParam); return pDockingManager->runProc(hwnd, message, wParam, lParam); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp index b6e3efd6c..7a25dd39b 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp @@ -130,13 +130,13 @@ LRESULT CALLBACK DockingSplitter::staticWinProc(HWND hwnd, UINT message, WPARAM switch (message) { case WM_NCCREATE : - pDockingSplitter = (DockingSplitter *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + pDockingSplitter = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); pDockingSplitter->_hSelf = hwnd; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pDockingSplitter); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pDockingSplitter)); return TRUE; default : - pDockingSplitter = (DockingSplitter *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); + pDockingSplitter = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); if (!pDockingSplitter) return ::DefWindowProc(hwnd, message, wParam, lParam); return pDockingSplitter->runProc(hwnd, message, wParam, lParam); @@ -151,7 +151,7 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_LBUTTONDOWN: { hWndMouse = hwnd; - hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, 0); + hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, reinterpret_cast(hookProcMouse), _hInst, 0); if (!hookMouse) { DWORD dwError = ::GetLastError(); @@ -192,11 +192,11 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM if ((_flags & DMS_HORIZONTAL) && (_ptOldPos.y != pt.y)) { - ::SendMessage(_hMessage, DMM_MOVE_SPLITTER, (WPARAM)_ptOldPos.y - pt.y, (LPARAM)_hSelf); + ::SendMessage(_hMessage, DMM_MOVE_SPLITTER, _ptOldPos.y - pt.y, reinterpret_cast(_hSelf)); } else if (_ptOldPos.x != pt.x) { - ::SendMessage(_hMessage, DMM_MOVE_SPLITTER, (WPARAM)_ptOldPos.x - pt.x, (LPARAM)_hSelf); + ::SendMessage(_hMessage, DMM_MOVE_SPLITTER, _ptOldPos.x - pt.x, reinterpret_cast(_hSelf)); } _ptOldPos = pt; } diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 32e96e53d..368eafc79 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -172,13 +172,13 @@ LRESULT CALLBACK Gripper::staticWinProc(HWND hwnd, UINT message, WPARAM wParam, switch (message) { case WM_NCCREATE : - pDlgMoving = (Gripper *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + pDlgMoving = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); pDlgMoving->_hSelf = hwnd; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pDlgMoving); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pDlgMoving)); return TRUE; default : - pDlgMoving = (Gripper *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); + pDlgMoving = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); if (!pDlgMoving) return ::DefWindowProc(hwnd, message, wParam, lParam); return pDlgMoving->runProc(message, wParam, lParam); @@ -442,12 +442,12 @@ void Gripper::doTabReordering(POINT pt) // get pointed tab item info.pt = pt; ::ScreenToClient(hTab, &info.pt); - auto iItem = ::SendMessage(hTab, TCM_HITTEST, 0, (LPARAM)&info); + auto iItem = ::SendMessage(hTab, TCM_HITTEST, 0, reinterpret_cast(&info)); if (iItem != -1) { // prevent flickering of tabs with different sizes - ::SendMessage(hTab, TCM_GETITEMRECT, iItem, (LPARAM)&rc); + ::SendMessage(hTab, TCM_GETITEMRECT, iItem, reinterpret_cast(&rc)); ClientRectToScreenRect(hTab, &rc); if ((rc.left + (_rcItem.right - _rcItem.left)) < pt.x) @@ -462,7 +462,7 @@ void Gripper::doTabReordering(POINT pt) // test if cusor points after last tab auto iLastItem = ::SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0) - 1; - ::SendMessage(hTab, TCM_GETITEMRECT, iLastItem, (LPARAM)&rc); + ::SendMessage(hTab, TCM_GETITEMRECT, iLastItem, reinterpret_cast(&rc)); if ((rc.left + rc.right) < pt.x) { _iItem = static_cast(iLastItem) + 1; @@ -504,7 +504,7 @@ void Gripper::doTabReordering(POINT pt) if (_hTab && ((_hTab != hTabOld) || (_iItem != iItemOld))) { _tcItem.mask = TCIF_PARAM | (_hTab == _hTabSource ? TCIF_TEXT : 0); - ::SendMessage(_hTab, TCM_INSERTITEM, _iItem, (LPARAM)&_tcItem); + ::SendMessage(_hTab, TCM_INSERTITEM, _iItem, reinterpret_cast(&_tcItem)); } // select the tab only in source tab window @@ -873,13 +873,13 @@ void Gripper::initTabInformation() /* get size of item */ _hTab = _hTabSource; - ::SendMessage(_hTabSource, TCM_GETITEMRECT, _iItem, (LPARAM)&_rcItem); + ::SendMessage(_hTabSource, TCM_GETITEMRECT, _iItem, reinterpret_cast(&_rcItem)); /* store item data */ static TCHAR szText[64]; _tcItem.mask = TCIF_PARAM | TCIF_TEXT; _tcItem.pszText = szText; _tcItem.cchTextMax = 64; - ::SendMessage(_hTabSource, TCM_GETITEM, _iItem, (LPARAM)&_tcItem); + ::SendMessage(_hTabSource, TCM_GETITEM, _iItem, reinterpret_cast(&_tcItem)); } diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 36ddc7103..46cb704c1 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -514,19 +514,19 @@ LRESULT CALLBACK ViewZoneDlg::canvas_runProc(HWND hwnd, UINT message, WPARAM wPa case WM_KEYDOWN: if (wParam == VK_UP) { - ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, (WPARAM)moveUp, 0); + ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, static_cast(moveUp), 0); } if (wParam == VK_DOWN) { - ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, (WPARAM)moveDown, 0); + ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, static_cast(moveDown), 0); } if (wParam == VK_PRIOR) { - ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, (WPARAM)moveUp, 1); + ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, static_cast(moveUp), 1); } if (wParam == VK_NEXT) { - ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, (WPARAM)moveDown, 1); + ::SendMessage(_hParent, DOCUMENTMAP_SCROLL, static_cast(moveDown), 1); } break; diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index 84953df2c..7a40f9aeb 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -465,7 +465,7 @@ void FileBrowser::notified(LPNMHDR notification) } // For File, Folder and Project - ::SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0,(LPARAM)(&(tvnotif->item))); + ::SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast(&(tvnotif->item))); } break; @@ -580,7 +580,7 @@ BrowserNodeType FileBrowser::getNodeType(HTREEITEM hItem) TVITEM tvItem; tvItem.hItem = hItem; tvItem.mask = TVIF_IMAGE | TVIF_PARAM; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); // File if (tvItem.iImage == INDEX_LEAF) @@ -1116,7 +1116,7 @@ bool FileBrowser::addInTree(generic_string rootPath, generic_string addItemFullP tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.hItem = hItemNode; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, (LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (linarPathArray[0] == tvItem.pszText) { @@ -1156,7 +1156,7 @@ HTREEITEM FileBrowser::findInTree(generic_string rootPath, HTREEITEM node, std:: tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.hItem = hItemNode; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, (LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (linarPathArray[0] == tvItem.pszText) { @@ -1360,7 +1360,7 @@ bool FolderUpdater::updateTree(DWORD action, const std::vector & // case FILE_ACTION_ADDED: // swprintf(msg2show, L"%s %s\n", explainAction(action), file2Change[0].c_str()); // printStr(msg2show); - //::PostMessage(thisFolderUpdater->_hFileBrowser, FB_ADDFILE, nullptr, (LPARAM)wstrFilename.GetString()); + //::PostMessage(thisFolderUpdater->_hFileBrowser, FB_ADDFILE, nullptr, reinterpret_cast(wstrFilename.GetString())); // break; // case FILE_ACTION_REMOVED: diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index a03bb0046..030be8660 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -232,12 +232,12 @@ void FunctionListPanel::reload() if (isOK) { TCHAR text2Search[MAX_PATH]; - ::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, (LPARAM)text2Search); + ::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast(text2Search)); bool isSorted = shouldSort(); addInStateArray(currentTree, text2Search, isSorted); } removeAllEntries(); - ::SendMessage(_hSearchEdit, WM_SETTEXT, 0, (LPARAM)TEXT("")); + ::SendMessage(_hSearchEdit, WM_SETTEXT, 0, reinterpret_cast(TEXT(""))); setSort(false); vector fi; @@ -352,14 +352,14 @@ bool FunctionListPanel::openSelection(const TreeView & treeView) TVITEM tvItem; tvItem.mask = TVIF_IMAGE | TVIF_PARAM; tvItem.hItem = treeView.getSelection(); - ::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + ::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.iImage == INDEX_ROOT || tvItem.iImage == INDEX_NODE) { return false; } - generic_string *posStr = (generic_string *)tvItem.lParam; + generic_string *posStr = reinterpret_cast(tvItem.lParam); if (!posStr) return false; @@ -519,7 +519,7 @@ bool FunctionListPanel::shouldSort() tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO); tbbuttonInfo.dwMask = TBIF_STATE; - ::SendMessage(_hToolbarMenu, TB_GETBUTTONINFO, IDC_SORTBUTTON_FUNCLIST, (LPARAM)&tbbuttonInfo); + ::SendMessage(_hToolbarMenu, TB_GETBUTTONINFO, IDC_SORTBUTTON_FUNCLIST, reinterpret_cast(&tbbuttonInfo)); return (tbbuttonInfo.fsState & TBSTATE_CHECKED) != 0; } @@ -530,7 +530,7 @@ void FunctionListPanel::setSort(bool isEnabled) tbbuttonInfo.cbSize = sizeof(TBBUTTONINFO); tbbuttonInfo.dwMask = TBIF_STATE; tbbuttonInfo.fsState = isEnabled ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED; - ::SendMessage(_hToolbarMenu, TB_SETBUTTONINFO, IDC_SORTBUTTON_FUNCLIST, (LPARAM)&tbbuttonInfo); + ::SendMessage(_hToolbarMenu, TB_SETBUTTONINFO, IDC_SORTBUTTON_FUNCLIST, reinterpret_cast(&tbbuttonInfo)); } INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) @@ -543,7 +543,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA // if the text not found modify the background color of the editor static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR); TCHAR text2search[MAX_PATH] ; - ::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, (LPARAM)text2search); + ::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast(text2search)); if (text2search[0] == '\0') { return FALSE; // no text, use the default color @@ -595,17 +595,17 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA tbButtons[1].iBitmap = 0; tbButtons[1].fsState = TBSTATE_ENABLED; tbButtons[1].fsStyle = BTNS_CHECK | BTNS_AUTOSIZE; - tbButtons[1].iString = (INT_PTR)TEXT(""); + tbButtons[1].iString = reinterpret_cast(TEXT("")); tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST; tbButtons[2].iBitmap = 1; tbButtons[2].fsState = TBSTATE_ENABLED; tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE; - tbButtons[2].iString = (INT_PTR)TEXT(""); + tbButtons[2].iString = reinterpret_cast(TEXT("")); - ::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); - ::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, (WPARAM)0, (LPARAM)MAKELONG(16, 16)); - ::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast(&tbButtons)); + ::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + ::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(16, 16)); + ::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast(&tbButtons)); ::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0); ShowWindow(_hToolbarMenu, SW_SHOW); @@ -618,11 +618,11 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA _hSearchEdit = CreateWindowEx(0, L"Edit", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL, 2, 2, editWidth, editHeight, - _hToolbarMenu, (HMENU) IDC_SEARCHFIELD_FUNCLIST, _hInst, 0 ); + _hToolbarMenu, reinterpret_cast(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 ); HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); if (hf) - ::SendMessage(_hSearchEdit, WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE, 0)); + ::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast(hf), MAKELPARAM(TRUE, 0)); _treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX); _treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST); diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index 1abac7be1..9bfd03a85 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -433,7 +433,7 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe } } else - SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer); + SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast(&BGcell), reinterpret_cast(buffer)); rectsave=rect; DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST); @@ -476,7 +476,7 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe else // iProperty will combine (iDataType << 4) and (iProtection & 0xf), // this will reduce some unnecessary and 'heavy' message calls for getting iDataType and iProtection separately - iProperty = static_cast(SendMessage(hWnd, BGM_GETCELLDATA, (WPARAM)&BGcell, (LPARAM)buffer)); + iProperty = static_cast(SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast(&BGcell), reinterpret_cast(buffer))); if(c==0) { @@ -487,7 +487,6 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe { HBRUSH hbrush,holdbrush; HPEN hpen,holdpen; - //iProtection = static_cast(SendMessage(hWnd, BGM_GETPROTECTION, (WPARAM)&BGcell, 0)); iProtection = iProperty & 0xf; if(BGHS[SI].DRAWHIGHLIGHT)//highlight on { @@ -545,7 +544,6 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe rect.right -= 2; rect.left += 2; - //iDataType = static_cast(SendMessage(hWnd, BGM_GETTYPE, (WPARAM)&BGcell, 0)); iDataType = iProperty >> 4 & 0xf; if((iDataType < 1)||(iDataType > 5)) { @@ -611,8 +609,8 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe WPARAM wParam; buffer[0]=0x20; BGHS[SI].ownerdrawitem = generic_atoi(buffer); - wParam=MAKEWPARAM((UINT)::GetMenu(hWnd),BGN_OWNERDRAW); - SendMessage(GetParent(hWnd),WM_COMMAND,wParam,(LPARAM)&rect); + wParam=MAKEWPARAM((UINT)::GetMenu(hWnd),BGN_OWNERDRAW); + SendMessage(GetParent(hWnd), WM_COMMAND, wParam, reinterpret_cast(&rect)); } if(BGHS[SI].EDITING) @@ -689,7 +687,7 @@ void DrawCursor(HWND hWnd,int SI) void SetCurrentCellStatus(HWND hWnd,int SelfIndex) { SetCell(&BGcell,BGHS[SelfIndex].cursorrow,BGHS[SelfIndex].cursorcol); - if(SendMessage(hWnd,BGM_GETPROTECTION,(WPARAM)&BGcell,0)) + if (SendMessage(hWnd, BGM_GETPROTECTION, reinterpret_cast(&BGcell), 0)) { BGHS[SelfIndex].CURRENTCELLPROTECTED = TRUE; } @@ -1151,7 +1149,7 @@ void CloseEdit(HWND hWnd,int SI) c=BGHS[SI].cursorcol; cell.row = r; cell.col = c; - SendMessage(hWnd,BGM_SETCELLDATA,(WPARAM)&cell,(LPARAM)BGHS[SI].editstring); + SendMessage(hWnd, BGM_SETCELLDATA, reinterpret_cast(&cell), reinterpret_cast(BGHS[SI].editstring)); lstrcpy(BGHS[SI].editstring, TEXT("")); RefreshGrid(hWnd); BGHS[SI].EDITING = FALSE; @@ -1567,7 +1565,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(FindResult != LB_ERR) { //it was found, get the text, modify text delete it from list, add modified to list - SendMessage(BGHS[SelfIndex].hlist1,LB_GETTEXT,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast(buffer)); if((BOOL)lParam) { buffer[10] = 'P'; @@ -1576,8 +1574,8 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { buffer[10] = 'U'; } - SendMessage(BGHS[SelfIndex].hlist1,LB_DELETESTRING,FindResult,0); - SendMessage(BGHS[SelfIndex].hlist1,LB_ADDSTRING,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_DELETESTRING, FindResult, 0); + SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, FindResult, reinterpret_cast(buffer)); } else { @@ -1593,7 +1591,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) lstrcat(buffer, TEXT("UA")); } lstrcat(buffer, TEXT("|")); - SendMessage(BGHS[SelfIndex].hlist1,LB_ADDSTRING,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, FindResult, reinterpret_cast(buffer)); } break; @@ -1673,7 +1671,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) lstrcat(buffer, TEXT("|")); lstrcat(buffer, (TCHAR*)lParam); - FindResult = static_cast(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, (LPARAM)buffer)); + FindResult = static_cast(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast(buffer))); if(FindResult==LB_ERR) { @@ -1790,7 +1788,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(FindResult != LB_ERR) { //it was found, get it - SendMessage(BGHS[SelfIndex].hlist1,LB_GETTEXT,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast(buffer)); switch (buffer[10]) // no need to call BGM_GETPROTECTION separately for this { case 'U': ReturnValue = 0; break; @@ -1946,7 +1944,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(FindResult != LB_ERR) { //it was found, get it - SendMessage(BGHS[SelfIndex].hlist1,LB_GETTEXT,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast(buffer)); switch (buffer[11]) { case 'A':ReturnValue=1;break; @@ -1975,7 +1973,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(FindResult != LB_ERR) { //it was found, get it - SendMessage(BGHS[SelfIndex].hlist1,LB_GETTEXT,FindResult,(LPARAM)buffer); + SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast(buffer)); switch (buffer[10]) { case 'U':ReturnValue=0;break; @@ -3151,7 +3149,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) BGHS[BG_GridIndex].htitlefont = hfonttitle; BGHS[BG_GridIndex].hcolumnheadingfont = hfontheader; lstrcpy(BGHS[BG_GridIndex].title,lpcs->lpszName); - SendMessage(hWnd,WM_SETTEXT,0,(LPARAM)lpcs->lpszName); + SendMessage(hWnd, WM_SETTEXT, 0, reinterpret_cast(lpcs->lpszName)); } diff --git a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h index 87d7206af..c4880594b 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h +++ b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h @@ -49,7 +49,7 @@ public : }; void setCursorColour(COLORREF coulour) { - ::SendMessage(_hSelf, BGM_SETCURSORCOLOR, (WPARAM)coulour, 0); + ::SendMessage(_hSelf, BGM_SETCURSORCOLOR, coulour, 0); }; void hideCursor() { @@ -64,7 +64,7 @@ public : _BGCELL cell; cell.row = int(row); cell.col = int(col); - ::SendMessage(_hSelf, BGM_SETCELLDATA, (WPARAM)&cell, (LPARAM)text); + ::SendMessage(_hSelf, BGM_SETCELLDATA, reinterpret_cast(&cell), reinterpret_cast(text)); }; void makeColAutoWidth(bool autoWidth = true) { @@ -79,7 +79,7 @@ public : _BGCELL cell; cell.row = row; cell.col = col; - ::SendMessage(_hSelf, BGM_DELETECELL, (WPARAM)&cell, 0); + ::SendMessage(_hSelf, BGM_DELETECELL, reinterpret_cast(&cell), 0); }; void setColWidth(unsigned int col, unsigned int width) { @@ -136,11 +136,11 @@ public : }; void setHeaderFont(const HFONT & hFont) const { - ::SendMessage(_hSelf, BGM_SETHEADINGFONT, (WPARAM)hFont, 0); + ::SendMessage(_hSelf, BGM_SETHEADINGFONT, reinterpret_cast(hFont), 0); }; void setRowFont(const HFONT & hFont) const { - ::SendMessage(_hSelf, WM_SETFONT, (WPARAM)hFont, 0); + ::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast(hFont), 0); }; void setHeaderHeight(const size_t headerHeight) const { diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index bc86a7bfc..06321b6ca 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -42,15 +42,15 @@ void ShortcutMapper::initTabs() { TCITEM tie; tie.mask = TCIF_TEXT; tie.pszText = tabNames[0]; - ::SendMessage(hTab, TCM_INSERTITEM, 0, (LPARAM)(&tie) ); + ::SendMessage(hTab, TCM_INSERTITEM, 0, reinterpret_cast(&tie)); tie.pszText = tabNames[1]; - ::SendMessage(hTab, TCM_INSERTITEM, 1, (LPARAM)(&tie) ); + ::SendMessage(hTab, TCM_INSERTITEM, 1, reinterpret_cast(&tie)); tie.pszText = tabNames[2]; - ::SendMessage(hTab, TCM_INSERTITEM, 2, (LPARAM)(&tie) ); + ::SendMessage(hTab, TCM_INSERTITEM, 2, reinterpret_cast(&tie)); tie.pszText = tabNames[3]; - ::SendMessage(hTab, TCM_INSERTITEM, 3, (LPARAM)(&tie) ); + ::SendMessage(hTab, TCM_INSERTITEM, 3, reinterpret_cast(&tie)); tie.pszText = tabNames[4]; - ::SendMessage(hTab, TCM_INSERTITEM, 4, (LPARAM)(&tie) ); + ::SendMessage(hTab, TCM_INSERTITEM, 4, reinterpret_cast(&tie)); TabCtrl_SetCurSel(_hTabCtrl, int(_currentState)); @@ -471,7 +471,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM shortcut._isShift = pcsc.getKeyCombo()._isShift; shortcut._key = pcsc.getKeyCombo()._key; - ::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, (LPARAM)&shortcut); + ::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast(&shortcut)); nppParam->setShortcutDirty(); } break; diff --git a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp index 33ce30986..7e6ab682a 100644 --- a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp +++ b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp @@ -341,7 +341,7 @@ static generic_string addExt(HWND textCtrl, HWND typeCtrl) { auto cbTextLen = ::SendMessage(typeCtrl, CB_GETLBTEXTLEN, i, 0); TCHAR * ext = new TCHAR[cbTextLen + 1]; - ::SendMessage(typeCtrl, CB_GETLBTEXT, i, (LPARAM)ext); + ::SendMessage(typeCtrl, CB_GETLBTEXT, i, reinterpret_cast(ext)); TCHAR *pExt = get1stExt(ext); if (*fn != '\0') @@ -365,7 +365,7 @@ UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, L NppParameters *pNppParam = NppParameters::getInstance(); int index = pNppParam->getFileSaveDlgFilterIndex(); - ::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)staticThis); + ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast(staticThis)); hFileDlg = ::GetParent(hWnd); goToCenter(hFileDlg); @@ -376,9 +376,9 @@ UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, L } // Don't touch the following 3 lines, they are cursed !!! - oldProc = (WNDPROC)::GetWindowLongPtr(hFileDlg, GWLP_WNDPROC); + oldProc = reinterpret_cast(::GetWindowLongPtr(hFileDlg, GWLP_WNDPROC)); if (oldProc) - ::SetWindowLongPtr(hFileDlg, GWLP_WNDPROC, (LONG_PTR)fileDlgProc); + ::SetWindowLongPtr(hFileDlg, GWLP_WNDPROC, reinterpret_cast(fileDlgProc)); return FALSE; } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 6723e6760..d71e28b4f 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -495,7 +495,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0); wchar_t langName[MAX_PATH]; - ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXT, index, (LPARAM)langName); + ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXT, index, reinterpret_cast(langName)); if (langName[0]) { @@ -603,11 +603,11 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa _verticalEdgeLineNbColVal.init(_hInst, _hSelf); _verticalEdgeLineNbColVal.create(::GetDlgItem(_hSelf, IDC_COLONENUMBER_STATIC), IDC_COLONENUMBER_STATIC); - ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("0")); - ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("1")); - ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("2")); - ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("3")); - ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Block")); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("0"))); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("1"))); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("2"))); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("3"))); + ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("Block"))); ::SendMessage(::GetDlgItem(_hSelf, IDC_WIDTH_COMBO), CB_SETCURSEL, nppGUI._caretWidth, 0); @@ -916,14 +916,14 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) case IDC_EDIT_SESSIONFILEEXT: { TCHAR sessionExt[MAX_PATH]; - ::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_GETTEXT, MAX_PATH, (LPARAM)sessionExt); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast(sessionExt)); nppGUI._definedSessionExt = sessionExt; return TRUE; } case IDC_EDIT_WORKSPACEFILEEXT: { TCHAR workspaceExt[MAX_PATH]; - ::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_GETTEXT, MAX_PATH, (LPARAM)workspaceExt); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast(workspaceExt)); nppGUI._definedWorkspaceExt = workspaceExt; return TRUE; } @@ -1176,7 +1176,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR int index = static_cast(::SendDlgItemMessage(_hSelf, IDC_COMBO_OTHERCP, CB_ADDSTRING, 0, reinterpret_cast(str.c_str()))); if (ndds._codepage == encodings[i]) selIndex = index; - ::SendDlgItemMessage(_hSelf, IDC_COMBO_OTHERCP, CB_SETITEMDATA, index, (LPARAM)encodings[i]); + ::SendDlgItemMessage(_hSelf, IDC_COMBO_OTHERCP, CB_SETITEMDATA, index, encodings[i]); } } @@ -1341,7 +1341,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT Message, WPARAM wParam, L shouldActivated = false; } ::SendDlgItemMessage(_hSelf, ID2Check, BM_SETCHECK, BST_CHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._defaultDir); + ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_SETTEXT, 0, reinterpret_cast(nppGUI._defaultDir)); ::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), shouldActivated); ::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), shouldActivated); @@ -1364,7 +1364,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT Message, WPARAM wParam, L case IDC_OPENSAVEDIR_ALWAYSON_EDIT: { TCHAR inputDir[MAX_PATH]; - ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir); + ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast(inputDir)); lstrcpy(nppGUI._defaultDir, inputDir); ::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, 500); pNppParam->setWorkingDir(nppGUI._defaultDirExp); @@ -1625,7 +1625,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP { ::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE); int idListbox2Disable = (LOWORD(wParam)== IDC_LIST_ENABLEDLANG)?IDC_LIST_DISABLEDLANG:IDC_LIST_ENABLEDLANG; - ::SendDlgItemMessage(_hSelf, idListbox2Disable, LB_SETCURSEL, (WPARAM)-1, 0); + ::SendDlgItemMessage(_hSelf, idListbox2Disable, LB_SETCURSEL, static_cast(-1), 0); ::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE); } return TRUE; @@ -1673,18 +1673,18 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP return TRUE; TCHAR s[32]; - ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXT, iRemove, (LPARAM)s); + ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXT, iRemove, reinterpret_cast(s)); LangMenuItem lmi = pSrcLst->at(iRemove); vector::iterator lang2Remove = pSrcLst->begin() + iRemove; pSrcLst->erase(lang2Remove); - auto iAdd = ::SendDlgItemMessage(_hSelf, list2Add, LB_ADDSTRING, 0, (LPARAM)s); + auto iAdd = ::SendDlgItemMessage(_hSelf, list2Add, LB_ADDSTRING, 0, reinterpret_cast(s)); ::SendDlgItemMessage(_hSelf, list2Remove, LB_DELETESTRING, iRemove, 0); pDestLst->push_back(lmi); ::SendDlgItemMessage(_hSelf, list2Add, LB_SETCURSEL, iAdd, 0); - ::SendDlgItemMessage(_hSelf, list2Remove, LB_SETCURSEL, (WPARAM)-1, 0); + ::SendDlgItemMessage(_hSelf, list2Remove, LB_SETCURSEL, static_cast(-1), 0); ::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE); ::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE); @@ -2076,7 +2076,7 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR TCHAR str[stringSize]; _focusedEditCtrl = LOWORD(wParam); ::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize); - ::SendDlgItemMessage(_hSelf, IDC_VIEWPANEL_STATIC, WM_SETTEXT, 0, (LPARAM)str); + ::SendDlgItemMessage(_hSelf, IDC_VIEWPANEL_STATIC, WM_SETTEXT, 0, reinterpret_cast(str)); switch (LOWORD(wParam)) { case IDC_EDIT_HLEFT: @@ -2167,7 +2167,7 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR case IDC_COMBO_FFONTSIZE : { TCHAR intStr[5]; - ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXT, iSel, (LPARAM)intStr); + ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXT, iSel, reinterpret_cast(intStr)); int *pVal = (LOWORD(wParam) == IDC_COMBO_HFONTSIZE)?&(nppGUI._printSettings._headerFontSize):&(nppGUI._printSettings._footerFontSize); @@ -2232,11 +2232,11 @@ INT_PTR CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR auto iSel = ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_GETCURSEL, 0, 0); TCHAR *varStr = (TCHAR *)::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_GETITEMDATA, iSel, 0); - ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, (WPARAM)&_selStart, (LPARAM)&_selEnd); + ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, reinterpret_cast(&_selStart), reinterpret_cast(&_selEnd)); const int stringSize = 256; TCHAR str[stringSize]; - ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, (LPARAM)str); + ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, reinterpret_cast(str)); generic_string str2Set(str); str2Set.replace(_selStart, _selEnd - _selStart, varStr); @@ -2486,23 +2486,23 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPA ::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doParentheses?BST_CHECKED:BST_UNCHECKED, 0); if (nppGUI._matchedPairConf._doParentheses) - ::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, WM_SETTEXT, 0, (LPARAM)TEXT(" ( )")); + ::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, WM_SETTEXT, 0, reinterpret_cast(TEXT(" ( )"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doBrackets?BST_CHECKED:BST_UNCHECKED, 0); if (nppGUI._matchedPairConf._doBrackets) - ::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, WM_SETTEXT, 0, (LPARAM)TEXT(" [ ]")); + ::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast(TEXT(" [ ]"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doCurlyBrackets?BST_CHECKED:BST_UNCHECKED, 0); if (nppGUI._matchedPairConf._doCurlyBrackets) - ::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, WM_SETTEXT, 0, (LPARAM)TEXT(" { }")); + ::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast(TEXT(" { }"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doQuotes?BST_CHECKED:BST_UNCHECKED, 0); if (nppGUI._matchedPairConf._doQuotes) - ::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, WM_SETTEXT, 0, (LPARAM)TEXT(" ' '")); + ::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast(TEXT(" ' '"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doDoubleQuotes?BST_CHECKED:BST_UNCHECKED, 0); if (nppGUI._matchedPairConf._doDoubleQuotes) - ::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, WM_SETTEXT, 0, (LPARAM)TEXT(" \" \"")); + ::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast(TEXT(" \" \""))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCTAG_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doHtmlXmlTag?BST_CHECKED:BST_UNCHECKED, 0); @@ -2527,18 +2527,18 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPA if (i == 0) { - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_SETTEXT, 0, (LPARAM)openChar); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_SETTEXT, 0, (LPARAM)closeChar); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_SETTEXT, 0, reinterpret_cast(openChar)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_SETTEXT, 0, reinterpret_cast(closeChar)); } else if (i == 1) { - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT2, WM_SETTEXT, 0, (LPARAM)openChar); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT2, WM_SETTEXT, 0, (LPARAM)closeChar); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT2, WM_SETTEXT, 0, reinterpret_cast(openChar)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT2, WM_SETTEXT, 0, reinterpret_cast(closeChar)); } if (i == 2) { - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT3, WM_SETTEXT, 0, (LPARAM)openChar); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT3, WM_SETTEXT, 0, (LPARAM)closeChar); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT3, WM_SETTEXT, 0, reinterpret_cast(openChar)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT3, WM_SETTEXT, 0, reinterpret_cast(closeChar)); } } @@ -2562,18 +2562,18 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPA TCHAR opener[2] = {'\0', '\0'}; TCHAR closer[2] = {'\0', '\0'}; - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_GETTEXT, MAX_PATH, (LPARAM)opener); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_GETTEXT, MAX_PATH, (LPARAM)closer); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast(opener)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast(closer)); if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT2, WM_GETTEXT, MAX_PATH, (LPARAM)opener); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT2, WM_GETTEXT, MAX_PATH, (LPARAM)closer); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT2, WM_GETTEXT, MAX_PATH, reinterpret_cast(opener)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT2, WM_GETTEXT, MAX_PATH, reinterpret_cast(closer)); if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT3, WM_GETTEXT, MAX_PATH, (LPARAM)opener); - ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT3, WM_GETTEXT, MAX_PATH, (LPARAM)closer); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT3, WM_GETTEXT, MAX_PATH, reinterpret_cast(opener)); + ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT3, WM_GETTEXT, MAX_PATH, reinterpret_cast(closer)); if (opener[0] < 0x80 && opener[0] != '\0' && closer[0] < 0x80 && closer[0] != '\0') nppGUI._matchedPairConf._matchedPairs.push_back(pair(static_cast(opener[0]), static_cast(closer[0]))); @@ -2695,7 +2695,7 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPA nppGUI._matchedPairConf._doQuotes = isChecked; label = isChecked?TEXT(" ' '"):TEXT(" '"); } - ::SendDlgItemMessage(_hSelf, static_cast(wParam), WM_SETTEXT, 0, (LPARAM)label); + ::SendDlgItemMessage(_hSelf, static_cast(wParam), WM_SETTEXT, 0, reinterpret_cast(label)); return TRUE; } @@ -2777,8 +2777,8 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, EM_LIMITTEXT, 1, 0); ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, EM_LIMITTEXT, 1, 0); - ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_SETTEXT, 0, (LPARAM)opener); - ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_SETTEXT, 0, (LPARAM)closer); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_SETTEXT, 0, reinterpret_cast(opener)); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_SETTEXT, 0, reinterpret_cast(closer)); ::SendDlgItemMessage(_hSelf, IDD_SEVERALLINEMODEON_CHECK, BM_SETCHECK, onSeveralLines?BST_CHECKED:BST_UNCHECKED, 0); POINT point = getTopPoint(::GetDlgItem(_hSelf, IDD_STATIC_BLABLA), false); @@ -2833,14 +2833,14 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, case IDC_EDIT_OPENDELIMITER: { TCHAR opener[2]; - ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, (LPARAM)opener); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast(opener)); nppGUI._leftmostDelimiter = static_cast(opener[0]); return TRUE; } case IDC_EDIT_CLOSEDELIMITER: { TCHAR closer[2]; - ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, (LPARAM)closer); + ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast(closer)); nppGUI._rightmostDelimiter = static_cast(closer[0]); return TRUE; } @@ -2889,7 +2889,7 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LP { TCHAR inputDir[MAX_PATH] = {'\0'}; TCHAR inputDirExpanded[MAX_PATH] = {'\0'}; - ::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir); + ::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast(inputDir)); ::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH); if (::PathFileExists(inputDirExpanded)) { diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index fbc953fe3..5f7714ae1 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -77,8 +77,8 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l tbButtons[1].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE; tbButtons[1].iString = (INT_PTR)edit_entry.c_str(); - SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); - SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons); + SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast(&tbButtons)); SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0); ShowWindow(_hToolbarMenu, SW_SHOW); @@ -403,7 +403,7 @@ bool ProjectPanel::writeWorkSpace(TCHAR *projectFileName) tvProj = _treeView.getNextSibling(tvProj)) { tvItem.hItem = tvProj; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); //printStr(tvItem.pszText); TiXmlNode *projRoot = root->InsertEndChild(TiXmlElement(TEXT("Project"))); @@ -427,7 +427,7 @@ void ProjectPanel::buildProjectXml(TiXmlNode *node, HTREEITEM hItem, const TCHAR hItemNode = _treeView.getNextSibling(hItemNode)) { tvItem.hItem = hItemNode; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.lParam != NULL) { generic_string *fn = (generic_string *)tvItem.lParam; @@ -505,7 +505,7 @@ void ProjectPanel::openSelectFile() TVITEM tvItem; tvItem.mask = TVIF_PARAM; tvItem.hItem = _treeView.getSelection(); - ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); NodeType nType = getNodeType(tvItem.hItem); generic_string *fn = (generic_string *)tvItem.lParam; @@ -514,7 +514,7 @@ void ProjectPanel::openSelectFile() tvItem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; if (::PathFileExists(fn->c_str())) { - ::SendMessage(_hParent, NPPM_DOOPEN, 0, (LPARAM)(fn->c_str())); + ::SendMessage(_hParent, NPPM_DOOPEN, 0, reinterpret_cast(fn->c_str())); tvItem.iImage = INDEX_LEAF; tvItem.iSelectedImage = INDEX_LEAF; } @@ -559,7 +559,7 @@ void ProjectPanel::notified(LPNMHDR notification) { // Get the old label tvItem.hItem = _treeView.getSelection(); - ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); size_t len = lstrlen(tvItem.pszText); // Find the position of old label in File path @@ -586,7 +586,7 @@ void ProjectPanel::notified(LPNMHDR notification) } // For File, Folder and Project - ::SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0,(LPARAM)(&(tvnotif->item))); + ::SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast(&(tvnotif->item))); setWorkSpaceDirty(true); } break; @@ -613,8 +613,6 @@ void ProjectPanel::notified(LPNMHDR notification) case TVN_KEYDOWN: { - //tvItem.hItem = _treeView.getSelection(); - //::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)notification; if (ptvkd->wVKey == VK_DELETE) @@ -698,7 +696,7 @@ NodeType ProjectPanel::getNodeType(HTREEITEM hItem) TVITEM tvItem; tvItem.hItem = hItem; tvItem.mask = TVIF_IMAGE | TVIF_PARAM; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); // Root if (tvItem.iImage == INDEX_CLEAN_ROOT || tvItem.iImage == INDEX_DIRTY_ROOT) @@ -758,7 +756,7 @@ POINT ProjectPanel::getMenuDisplayPoint(int iButton) { POINT p; RECT btnRect; - SendMessage(_hToolbarMenu, TB_GETITEMRECT, iButton, (LPARAM)&btnRect); + SendMessage(_hToolbarMenu, TB_GETITEMRECT, iButton, reinterpret_cast(&btnRect)); p.x = btnRect.left; p.y = btnRect.top + btnRect.bottom; @@ -1018,7 +1016,7 @@ void ProjectPanel::popupMenuCmd(int cmdID) tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; - SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (!tvItem.lParam) return; generic_string * fn = (generic_string *)tvItem.lParam; @@ -1034,7 +1032,7 @@ void ProjectPanel::popupMenuCmd(int cmdID) lstrcpy(textBuffer, strValueLabel); int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID; tvItem.iImage = tvItem.iSelectedImage = iImage; - SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0,(LPARAM)&tvItem); + SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast(&tvItem)); setWorkSpaceDirty(true); } } diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp index 8adaa8965..691d99885 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp @@ -51,7 +51,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID) int itemHeight = NppParameters::getInstance()->_dpiManager.scaleY(CY_ITEMHEIGHT); TreeView_SetItemHeight(_hSelf, itemHeight); - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _defaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticProc))); } @@ -89,15 +89,15 @@ bool TreeView::setItemParam(HTREEITEM Item2Set, const TCHAR *paramStr) tvItem.hItem = Item2Set; tvItem.mask = TVIF_PARAM; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (!tvItem.lParam) - tvItem.lParam = (LPARAM)(new generic_string(paramStr)); + tvItem.lParam = reinterpret_cast(new generic_string(paramStr)); else { *((generic_string *)tvItem.lParam) = paramStr; } - SendMessage(_hSelf, TVM_SETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_SETITEM, 0, reinterpret_cast(&tvItem)); return true; } @@ -111,7 +111,7 @@ LPARAM TreeView::getItemParam(HTREEITEM Item2Get) const tvItem.mask = TVIF_PARAM; //tvItem.pszText = textBuffer; tvItem.lParam = 0; - SendMessage(_hSelf, TVM_GETITEM, 0, (LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); return tvItem.lParam; } @@ -125,7 +125,7 @@ generic_string TreeView::getItemDisplayName(HTREEITEM Item2Set) const tvItem.mask = TVIF_TEXT; tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; - SendMessage(_hSelf, TVM_GETITEM, 0, (LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); return tvItem.pszText; } @@ -139,7 +139,7 @@ bool TreeView::renameItem(HTREEITEM Item2Set, const TCHAR *newName) tvItem.mask = TVIF_TEXT; tvItem.pszText = (LPWSTR)newName; tvItem.cchTextMax = MAX_PATH; - SendMessage(_hSelf, TVM_SETITEM, 0, (LPARAM)&tvItem); + SendMessage(_hSelf, TVM_SETITEM, 0, reinterpret_cast(&tvItem)); return true; } @@ -157,14 +157,14 @@ HTREEITEM TreeView::addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iI tvi.iSelectedImage = iImage;//isNode?INDEX_OPEN_NODE:INDEX_LEAF; // Save the full path of file in the item's application-defined data area. - tvi.lParam = (filePath == NULL?0:(LPARAM)(new generic_string(filePath))); + tvi.lParam = (filePath == NULL ? 0 : reinterpret_cast(new generic_string(filePath))); TVINSERTSTRUCT tvInsertStruct; tvInsertStruct.item = tvi; - tvInsertStruct.hInsertAfter = (HTREEITEM)TVI_LAST; + tvInsertStruct.hInsertAfter = TVI_LAST; tvInsertStruct.hParent = hParentItem; - return (HTREEITEM)::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertStruct); + return reinterpret_cast(::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertStruct))); } void TreeView::removeItem(HTREEITEM hTreeItem) @@ -176,7 +176,7 @@ void TreeView::removeItem(HTREEITEM hTreeItem) TVITEM tvItem; tvItem.hItem = hTreeItem; tvItem.mask = TVIF_PARAM; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.lParam) delete (generic_string *)(tvItem.lParam); @@ -206,17 +206,17 @@ void TreeView::dupTree(HTREEITEM hTree2Dup, HTREEITEM hParentItem) tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.lParam) { - tvItem.lParam = (LPARAM)(new generic_string(*((generic_string *)(tvItem.lParam)))); + tvItem.lParam = reinterpret_cast(new generic_string(*(reinterpret_cast(tvItem.lParam)))); } TVINSERTSTRUCT tvInsertStruct; tvInsertStruct.item = tvItem; - tvInsertStruct.hInsertAfter = (HTREEITEM)TVI_LAST; + tvInsertStruct.hInsertAfter = TVI_LAST; tvInsertStruct.hParent = hParentItem; - HTREEITEM hTreeParent = (HTREEITEM)::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertStruct); + HTREEITEM hTreeParent = reinterpret_cast(::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertStruct))); dupTree(hItem, hTreeParent); } } @@ -237,7 +237,7 @@ HTREEITEM TreeView::searchSubItemByName(const TCHAR *itemName, HTREEITEM hParent tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.mask = TVIF_TEXT; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (lstrcmp(itemName, tvItem.pszText) == 0) { @@ -254,10 +254,10 @@ void TreeView::cleanSubEntries(HTREEITEM hTreeItem) TVITEM tvItem; tvItem.hItem = hItem; tvItem.mask = TVIF_PARAM; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.lParam) { - delete (generic_string *)(tvItem.lParam); + delete reinterpret_cast(tvItem.lParam); } cleanSubEntries(hItem); } @@ -282,7 +282,7 @@ void TreeView::beginDrag(NMTREEVIEW* tv) // create dragging image for you using TVM_CREATEDRAGIMAGE // You have to delete it after drop operation, so remember it. _draggedItem = tv->itemNew.hItem; - _draggedImageList = (HIMAGELIST)::SendMessage(_hSelf, TVM_CREATEDRAGIMAGE, (WPARAM)0, (LPARAM)_draggedItem); + _draggedImageList = reinterpret_cast(::SendMessage(_hSelf, TVM_CREATEDRAGIMAGE, 0, reinterpret_cast(_draggedItem))); // start dragging operation // PARAMS: HIMAGELIST, imageIndex, xHotspot, yHotspot @@ -316,10 +316,10 @@ void TreeView::dragItem(HWND parentHandle, int x, int y) TVHITTESTINFO hitTestInfo; hitTestInfo.pt.x = point.x; hitTestInfo.pt.y = point.y; - HTREEITEM targetItem = (HTREEITEM)::SendMessage(_hSelf, TVM_HITTEST, (WPARAM)0, (LPARAM)&hitTestInfo); + HTREEITEM targetItem = reinterpret_cast(::SendMessage(_hSelf, TVM_HITTEST, 0, reinterpret_cast(&hitTestInfo))); if(targetItem) { - ::SendMessage(_hSelf, TVM_SELECTITEM, (WPARAM)(TVGN_DROPHILITE), (LPARAM)targetItem); + ::SendMessage(_hSelf, TVM_SELECTITEM, TVGN_DROPHILITE, reinterpret_cast(targetItem)); } // show the dragged image @@ -330,7 +330,7 @@ bool TreeView::dropItem() { bool isFilesMoved = false; // get the target item - HTREEITEM targetItem = (HTREEITEM)::SendMessage(_hSelf, TVM_GETNEXTITEM, (WPARAM)TVGN_DROPHILITE, (LPARAM)0); + HTREEITEM targetItem = reinterpret_cast(::SendMessage(_hSelf, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0)); // make a copy of the dragged item and insert the clone under // the target item, then, delete the original dragged item @@ -347,7 +347,7 @@ bool TreeView::dropItem() ::ReleaseCapture(); ::ShowCursor(true); - SendMessage(_hSelf,TVM_SELECTITEM,TVGN_CARET,(LPARAM)targetItem); + SendMessage(_hSelf, TVM_SELECTITEM, TVGN_CARET, reinterpret_cast(targetItem)); SendMessage(_hSelf,TVM_SELECTITEM,TVGN_DROPHILITE,0); // clear global variables @@ -407,17 +407,17 @@ void TreeView::moveTreeViewItem(HTREEITEM draggedItem, HTREEITEM targetItem) tvDraggingItem.pszText = textBuffer; tvDraggingItem.cchTextMax = MAX_PATH; tvDraggingItem.hItem = draggedItem; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvDraggingItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvDraggingItem)); if (tvDraggingItem.lParam) - tvDraggingItem.lParam = (LPARAM)(new generic_string(*((generic_string *)(tvDraggingItem.lParam)))); + tvDraggingItem.lParam = reinterpret_cast(new generic_string(*(reinterpret_cast(tvDraggingItem.lParam)))); TVINSERTSTRUCT tvInsertStruct; tvInsertStruct.item = tvDraggingItem; tvInsertStruct.hInsertAfter = (HTREEITEM)TVI_LAST; tvInsertStruct.hParent = targetItem; - HTREEITEM hTreeParent = (HTREEITEM)::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertStruct); + HTREEITEM hTreeParent = reinterpret_cast(::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertStruct))); dupTree(draggedItem, hTreeParent); removeItem(draggedItem); } @@ -465,29 +465,29 @@ bool TreeView::swapTreeViewItem(HTREEITEM itemGoDown, HTREEITEM itemGoUp) tvDownItem.cchTextMax = MAX_PATH; tvUpItem.hItem = itemGoUp; tvDownItem.hItem = itemGoDown; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvUpItem); - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvDownItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvUpItem)); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvDownItem)); // make copy recursively for both items if (tvUpItem.lParam) - tvUpItem.lParam = (LPARAM)(new generic_string(*((generic_string *)(tvUpItem.lParam)))); + tvUpItem.lParam = reinterpret_cast(new generic_string(*(reinterpret_cast(tvUpItem.lParam)))); if (tvDownItem.lParam) - tvDownItem.lParam = (LPARAM)(new generic_string(*((generic_string *)(tvDownItem.lParam)))); + tvDownItem.lParam = reinterpret_cast(new generic_string(*(reinterpret_cast(tvDownItem.lParam)))); // add 2 new items TVINSERTSTRUCT tvInsertUp; tvInsertUp.item = tvUpItem; tvInsertUp.hInsertAfter = itemTop; tvInsertUp.hParent = parentGoUp; - HTREEITEM hTreeParent1stInserted = (HTREEITEM)::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertUp); + HTREEITEM hTreeParent1stInserted = reinterpret_cast(::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertUp))); dupTree(itemGoUp, hTreeParent1stInserted); TVINSERTSTRUCT tvInsertDown; tvInsertDown.item = tvDownItem; tvInsertDown.hInsertAfter = hTreeParent1stInserted; tvInsertDown.hParent = parentGoDown; - HTREEITEM hTreeParent2ndInserted = (HTREEITEM)::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertDown); + HTREEITEM hTreeParent2ndInserted = reinterpret_cast(::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertDown))); dupTree(itemGoDown, hTreeParent2ndInserted); // remove 2 old items @@ -515,7 +515,7 @@ bool TreeView::canDropIn(HTREEITEM targetItem) TVITEM tvItem; tvItem.mask = TVIF_IMAGE; tvItem.hItem = targetItem; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); for (size_t i = 0, len = _canNotDropInList.size(); i < len; ++i) { @@ -531,7 +531,7 @@ bool TreeView::canDragOut(HTREEITEM targetItem) TVITEM tvItem; tvItem.mask = TVIF_IMAGE; tvItem.hItem = targetItem; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); for (size_t i = 0, len = _canNotDragOutList.size(); i < len; ++i) { @@ -562,7 +562,7 @@ bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const gene tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (tvItem.iImage == index2Search) { @@ -574,13 +574,13 @@ bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const gene { if (tvItem.lParam) { - tvItem.lParam = (LPARAM)(new generic_string(*((generic_string *)(tvItem.lParam)))); + tvItem.lParam = reinterpret_cast(new generic_string(*(reinterpret_cast(tvItem.lParam)))); } TVINSERTSTRUCT tvInsertStruct; tvInsertStruct.item = tvItem; - tvInsertStruct.hInsertAfter = (HTREEITEM)TVI_LAST; + tvInsertStruct.hInsertAfter = TVI_LAST; tvInsertStruct.hParent = tree2Build; - ::SendMessage(_hSelf, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvInsertStruct); + ::SendMessage(_hSelf, TVM_INSERTITEM, 0, reinterpret_cast(&tvInsertStruct)); } } @@ -608,7 +608,7 @@ bool TreeView::retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREE tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); treeState2Construct._label = textBuffer; treeState2Construct._isExpanded = (tvItem.state & TVIS_EXPANDED) != 0; @@ -640,14 +640,14 @@ bool TreeView::restoreFoldingStateFrom(const TreeStateNode & treeState2Compare, tvItem.pszText = textBuffer; tvItem.cchTextMax = MAX_PATH; tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; - SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); + SendMessage(_hSelf, TVM_GETITEM, 0, reinterpret_cast(&tvItem)); if (treeState2Compare._label != textBuffer) return false; if (tvItem.lParam) { - if (treeState2Compare._extraData != *((generic_string *)tvItem.lParam)) + if (treeState2Compare._extraData != *(reinterpret_cast(tvItem.lParam))) return false; } @@ -675,7 +675,7 @@ bool TreeView::restoreFoldingStateFrom(const TreeStateNode & treeState2Compare, void TreeView::sort(HTREEITEM hTreeItem) { - ::SendMessage(_hSelf, TVM_SORTCHILDREN, TRUE, (LPARAM)hTreeItem); + ::SendMessage(_hSelf, TVM_SORTCHILDREN, TRUE, reinterpret_cast(hTreeItem)); for (HTREEITEM hItem = getChildFrom(hTreeItem); hItem != NULL; hItem = getNextSibling(hItem)) sort(hItem); diff --git a/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp b/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp index ac64ae3e8..f1fd57ddd 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp +++ b/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp @@ -239,9 +239,9 @@ LRESULT CALLBACK Splitter::staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP { case WM_NCCREATE: { - Splitter * pSplitter = (Splitter *)((LPCREATESTRUCT)lParam)->lpCreateParams; + Splitter * pSplitter = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); pSplitter->_hSelf = hWnd; - ::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pSplitter); + ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast(pSplitter)); return TRUE; } default: diff --git a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp index 092f6a4ca..2ef779fde 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp +++ b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp @@ -159,9 +159,9 @@ LRESULT CALLBACK SplitterContainer::staticWinProc(HWND hwnd, UINT message, WPARA { case WM_NCCREATE: { - pSplitterContainer = (SplitterContainer *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + pSplitterContainer = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); pSplitterContainer->_hSelf = hwnd; - ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pSplitterContainer); + ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(pSplitterContainer)); return TRUE; } @@ -315,7 +315,7 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam) ? (pt.x < 0 ? _pWin0 : _pWin1) : (pt.y < 0 ? _pWin0 : _pWin1); - ::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)targetWindow->getHSelf()); + ::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, reinterpret_cast(targetWindow->getHSelf())); ::SendMessage(parent, WM_COMMAND, IDM_FILE_NEW, 0); return TRUE; } diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index f8d9144c3..be034256a 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -135,7 +135,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str wsprintf(expandedStr, TEXT("%d"), lineNumber); } else - ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, CURRENTWORD_MAXLENGTH, (LPARAM)expandedStr); + ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, CURRENTWORD_MAXLENGTH, reinterpret_cast(expandedStr)); for (size_t p = 0, len3 = size_t(lstrlen(expandedStr)); p < len3; ++p) { @@ -306,15 +306,15 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) void RunDlg::addTextToCombo(const TCHAR *txt2Add) const { HWND handle = ::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH); - auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)txt2Add); + auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, static_cast(-1), reinterpret_cast(txt2Add)); if (i == CB_ERR) - i = ::SendMessage(handle, CB_ADDSTRING, 0, (LPARAM)txt2Add); + i = ::SendMessage(handle, CB_ADDSTRING, 0, reinterpret_cast(txt2Add)); ::SendMessage(handle, CB_SETCURSEL, i, 0); } void RunDlg::removeTextFromCombo(const TCHAR *txt2Remove) const { HWND handle = ::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH); - auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)txt2Remove); + auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, static_cast(-1), reinterpret_cast(txt2Remove)); if (i == CB_ERR) return; ::SendMessage(handle, CB_DELETESTRING, i, 0); diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 1a16f2437..95a12725b 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -171,7 +171,7 @@ void TabBar::deletItemAt(size_t index) if (_nbItem > 1) { RECT itemRect; - ::SendMessage(_hSelf, TCM_GETITEMRECT, (WPARAM)index, (LPARAM)&itemRect); + ::SendMessage(_hSelf, TCM_GETITEMRECT, index, reinterpret_cast(&itemRect)); if (itemRect.left < 5) //if last visible tab, scroll left once (no more than 5px away should be safe, usually 2px depending on the drawing) { //To scroll the tab control to the left, use the WM_HSCROLL notification @@ -194,7 +194,7 @@ void TabBar::deletItemAt(size_t index) void TabBar::setImageList(HIMAGELIST himl) { _hasImgLst = true; - ::SendMessage(_hSelf, TCM_SETIMAGELIST, 0, (LPARAM)himl); + ::SendMessage(_hSelf, TCM_SETIMAGELIST, 0, reinterpret_cast(himl)); } @@ -291,11 +291,12 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad NULL, _hInst, 0); + if (!_tooltips) { throw std::runtime_error("TabBarPlus::init : tooltip CreateWindowEx() function return null"); } - ::SendMessage(_hSelf, TCM_SETTOOLTIPS, (WPARAM)_tooltips, 0); + ::SendMessage(_hSelf, TCM_SETTOOLTIPS, reinterpret_cast(_tooltips), 0); if (!_isTraditional) { @@ -322,7 +323,7 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad } ++_nbCtrl; - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _tabBarDefaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(TabBarPlus_Proc))); } @@ -490,14 +491,14 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara else if (not _isMultiLine) // don't scroll if in multi-line mode { RECT rcTabCtrl, rcLastTab; - ::SendMessage(_hSelf, TCM_GETITEMRECT, lastTabIndex, (LPARAM)&rcLastTab); + ::SendMessage(_hSelf, TCM_GETITEMRECT, lastTabIndex, reinterpret_cast(&rcLastTab)); ::GetClientRect(_hSelf, &rcTabCtrl); // get index of the first visible tab TC_HITTESTINFO hti; LONG xy = NppParameters::getInstance()->_dpiManager.scaleX(12); // an arbitrary coordinate inside the first visible tab hti.pt = { xy, xy }; - LRESULT scrollTabIndex = ::SendMessage(_hSelf, TCM_HITTEST, 0, (LPARAM)&hti); + LRESULT scrollTabIndex = ::SendMessage(_hSelf, TCM_HITTEST, 0, reinterpret_cast(&hti)); if (scrollTabIndex < 1 && (_isVertical ? rcLastTab.bottom < rcTabCtrl.bottom : rcLastTab.right < rcTabCtrl.right)) // nothing to scroll return TRUE; @@ -614,7 +615,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara _currentHoverTabItem = getTabIndexAt(xPos, yPos); if (_currentHoverTabItem != -1) { - ::SendMessage(_hSelf, TCM_GETITEMRECT, _currentHoverTabItem, (LPARAM)&_currentHoverTabRect); + ::SendMessage(_hSelf, TCM_GETITEMRECT, _currentHoverTabItem, reinterpret_cast(&_currentHoverTabRect)); _isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect, _isVertical); } else @@ -848,7 +849,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) barRect.bottom = barRect.top + topBarHeight; } - if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf)) + if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, reinterpret_cast(_hSelf))) hBrush = ::CreateSolidBrush(_activeTopBarFocusedColour); // #FAAA3C else hBrush = ::CreateSolidBrush(_activeTopBarUnfocusedColour); // #FAD296 diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 743b6c023..9cb4584a5 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -275,7 +275,7 @@ protected: TCHITTESTINFO hitInfo; hitInfo.pt.x = x; hitInfo.pt.y = y; - return static_cast(::SendMessage(_hSelf, TCM_HITTEST, 0, (LPARAM)&hitInfo)); + return static_cast(::SendMessage(_hSelf, TCM_HITTEST, 0, reinterpret_cast(&hitInfo))); } bool isPointInParentZone(POINT screenPoint) const diff --git a/PowerEditor/src/WinControls/TaskList/TaskList.cpp b/PowerEditor/src/WinControls/TaskList/TaskList.cpp index fcf69d177..7f63a7c12 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskList.cpp +++ b/PowerEditor/src/WinControls/TaskList/TaskList.cpp @@ -60,7 +60,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem 0, 0, _hParent, - (HMENU) NULL, + NULL, hInst, NULL); if (!_hSelf) @@ -68,7 +68,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem throw std::runtime_error("TaskList::init : CreateWindowEx() function return null"); } - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _defaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticProc))); DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf); diff --git a/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp b/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp index eb33787a5..c665a3acb 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp +++ b/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp @@ -60,7 +60,7 @@ INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP { case WM_INITDIALOG : { - ::SendMessage(_hParent, WM_GETTASKLISTINFO, (WPARAM)&_taskListInfo, 0); + ::SendMessage(_hParent, WM_GETTASKLISTINFO, reinterpret_cast(&_taskListInfo), 0); int nbTotal = static_cast(_taskListInfo._tlfsLst.size()); int i2set = _taskListInfo._currentIndex + (_initDir == dirDown?1:-1); diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 454a5a538..66efe3ee8 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -193,15 +193,15 @@ int ToolBar::getWidth() const { RECT btnRect; int totalWidth = 0; for(size_t i = 0; i < _nrCurrentButtons; ++i) { - ::SendMessage(_hSelf, TB_GETITEMRECT, i, (LPARAM)&btnRect); + ::SendMessage(_hSelf, TB_GETITEMRECT, i, reinterpret_cast(&btnRect)); totalWidth += btnRect.right - btnRect.left; } return totalWidth; } int ToolBar::getHeight() const { - DWORD size = (DWORD)SendMessage(_hSelf, TB_GETBUTTONSIZE, 0, 0); - DWORD padding = (DWORD)SendMessage(_hSelf, TB_GETPADDING, 0, 0); + DWORD size = static_cast(SendMessage(_hSelf, TB_GETBUTTONSIZE, 0, 0)); + DWORD padding = static_cast(SendMessage(_hSelf, TB_GETPADDING, 0, 0)); int totalHeight = HIWORD(size) + HIWORD(padding) - 3; return totalHeight; } @@ -249,15 +249,17 @@ void ToolBar::reset(bool create) if(create && _hSelf) { //Store current button state information TBBUTTON tempBtn; - for(size_t i = 0; i < _nrCurrentButtons; ++i) { - ::SendMessage(_hSelf, TB_GETBUTTON, (WPARAM)i, (LPARAM)&tempBtn); + for(size_t i = 0; i < _nrCurrentButtons; ++i) + { + ::SendMessage(_hSelf, TB_GETBUTTON, i, reinterpret_cast(&tempBtn)); _pTBB[i].fsState = tempBtn.fsState; } ::DestroyWindow(_hSelf); _hSelf = NULL; } - if(!_hSelf) { + if(!_hSelf) + { _hSelf = ::CreateWindowEx( WS_EX_PALETTEWINDOW, TOOLBARCLASSNAME, @@ -271,8 +273,8 @@ void ToolBar::reset(bool create) 0); // Send the TB_BUTTONSTRUCTSIZE message, which is required for // backward compatibility. - ::SendMessage(_hSelf, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); - ::SendMessage(_hSelf, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_HIDECLIPPEDBUTTONS); + ::SendMessage(_hSelf, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + ::SendMessage(_hSelf, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS); } if (!_hSelf) @@ -299,18 +301,18 @@ void ToolBar::reset(bool create) for (size_t i = 0 ; i < _nrButtons ; ++i) { int icoID = _toolBarIcons.getStdIconAt(static_cast(i)); - HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, MAKEINTRESOURCE(icoID), IMAGE_BITMAP, iconDpiDynamicalSize, iconDpiDynamicalSize, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); - addbmp.nID = (UINT_PTR)hBmp; + HBITMAP hBmp = static_cast(::LoadImage(_hInst, MAKEINTRESOURCE(icoID), IMAGE_BITMAP, iconDpiDynamicalSize, iconDpiDynamicalSize, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT)); + addbmp.nID = reinterpret_cast(hBmp); //addbmp.nID = _toolBarIcons.getStdIconAt(i); - ::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmp); + ::SendMessage(_hSelf, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); } if (_nrDynButtons > 0) { for (size_t j = 0; j < _nrDynButtons; ++j) { - addbmpdyn.nID = (UINT_PTR)_vDynBtnReg.at(j).hBmp; - ::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmpdyn); + addbmpdyn.nID = reinterpret_cast(_vDynBtnReg.at(j).hBmp); + ::SendMessage(_hSelf, TB_ADDBITMAP, 1, reinterpret_cast(&addbmpdyn)); } } } @@ -320,8 +322,8 @@ void ToolBar::reset(bool create) size_t nrBtnToAdd = (_state == TB_STANDARD?_nrTotalButtons:_nrButtons); _nrCurrentButtons = nrBtnToAdd; WORD btnSize = (_state == TB_LARGE?32:16); - ::SendMessage(_hSelf, TB_SETBUTTONSIZE , (WPARAM)0, (LPARAM)MAKELONG (btnSize, btnSize)); - ::SendMessage(_hSelf, TB_ADDBUTTONS, (WPARAM)nrBtnToAdd, (LPARAM)_pTBB); + ::SendMessage(_hSelf, TB_SETBUTTONSIZE , 0, MAKELONG(btnSize, btnSize)); + ::SendMessage(_hSelf, TB_ADDBUTTONS, nrBtnToAdd, reinterpret_cast(_pTBB)); } ::SendMessage(_hSelf, TB_AUTOSIZE, 0, 0); @@ -359,7 +361,7 @@ void ToolBar::doPopop(POINT chevPoint) RECT btnRect = {0,0,0,0}; while(start < _nrCurrentButtons) { - ::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect); + ::SendMessage(_hSelf, TB_GETITEMRECT, start, reinterpret_cast(&btnRect)); if(btnRect.right > width) break; ++start; @@ -429,7 +431,7 @@ void ReBar::init(HINSTANCE hInst, HWND hPere) rbi.cbSize = sizeof(REBARINFO); rbi.fMask = 0; rbi.himl = (HIMAGELIST)NULL; - ::SendMessage(_hSelf, RB_SETBARINFO, 0, (LPARAM)&rbi); + ::SendMessage(_hSelf, RB_SETBARINFO, 0, reinterpret_cast(&rbi)); } bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) @@ -449,27 +451,27 @@ bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) } else { rBand->wID = getNewID(); } - ::SendMessage(_hSelf, RB_INSERTBAND, (WPARAM)-1, (LPARAM)rBand); //add to end of list + ::SendMessage(_hSelf, RB_INSERTBAND, static_cast(-1), reinterpret_cast(rBand)); //add to end of list return true; } void ReBar::reNew(int id, REBARBANDINFO * rBand) { - auto index = SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); - ::SendMessage(_hSelf, RB_SETBANDINFO, (WPARAM)index, (LPARAM)rBand); + auto index = SendMessage(_hSelf, RB_IDTOINDEX, id, 0); + ::SendMessage(_hSelf, RB_SETBANDINFO, index, reinterpret_cast(rBand)); }; void ReBar::removeBand(int id) { - auto index = SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); + auto index = SendMessage(_hSelf, RB_IDTOINDEX, id, 0); if (id >= REBAR_BAR_EXTERNAL) releaseID(id); - ::SendMessage(_hSelf, RB_DELETEBAND, (WPARAM)index, (LPARAM)0); + ::SendMessage(_hSelf, RB_DELETEBAND, index, 0); } void ReBar::setIDVisible(int id, bool show) { - auto index = SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); + auto index = SendMessage(_hSelf, RB_IDTOINDEX, id, 0); if (index == -1 ) return; //error @@ -479,17 +481,17 @@ void ReBar::setIDVisible(int id, bool show) rbBand.fMask = RBBIM_STYLE; - ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); + ::SendMessage(_hSelf, RB_GETBANDINFO, index, reinterpret_cast(&rbBand)); if (show) rbBand.fStyle &= (RBBS_HIDDEN ^ -1); else rbBand.fStyle |= RBBS_HIDDEN; - ::SendMessage(_hSelf, RB_SETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); + ::SendMessage(_hSelf, RB_SETBANDINFO, index, reinterpret_cast(&rbBand)); } bool ReBar::getIDVisible(int id) { - auto index = SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); + auto index = SendMessage(_hSelf, RB_IDTOINDEX, id, 0); if (index == -1 ) return false; //error REBARBANDINFO rbBand; @@ -497,14 +499,14 @@ bool ReBar::getIDVisible(int id) rbBand.cbSize = REBARBAND_SIZE; rbBand.fMask = RBBIM_STYLE; - ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); + ::SendMessage(_hSelf, RB_GETBANDINFO, index, reinterpret_cast(&rbBand)); return ((rbBand.fStyle & RBBS_HIDDEN) == 0); } void ReBar::setGrayBackground(int id) { - auto index = SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); + auto index = SendMessage(_hSelf, RB_IDTOINDEX, id, 0); if (index == -1 ) return; //error REBARBANDINFO rbBand; @@ -512,7 +514,7 @@ void ReBar::setGrayBackground(int id) rbBand.cbSize = REBARBAND_SIZE; rbBand.fMask = RBBIM_BACKGROUND; rbBand.hbmBack = LoadBitmap((HINSTANCE)::GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_INCREMENTAL_BG)); - ::SendMessage(_hSelf, RB_SETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); + ::SendMessage(_hSelf, RB_SETBANDINFO, index, reinterpret_cast(&rbBand)); } int ReBar::getNewID() diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index 24cbe8f9b..1c228bb86 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -76,7 +76,7 @@ public : virtual void destroy(); void enable(int cmdID, bool doEnable) const { - ::SendMessage(_hSelf, TB_ENABLEBUTTON, cmdID, (LPARAM)doEnable); + ::SendMessage(_hSelf, TB_ENABLEBUTTON, cmdID, static_cast(doEnable)); }; int getWidth() const; @@ -87,11 +87,11 @@ public : void setToUglyIcons(); bool getCheckState(int ID2Check) const { - return bool(::SendMessage(_hSelf, TB_GETSTATE, (WPARAM)ID2Check, 0) & TBSTATE_CHECKED); + return bool(::SendMessage(_hSelf, TB_GETSTATE, ID2Check, 0) & TBSTATE_CHECKED); }; void setCheck(int ID2Check, bool willBeChecked) const { - ::SendMessage(_hSelf, TB_CHECKBUTTON, (WPARAM)ID2Check, (LPARAM)MAKELONG(willBeChecked, 0)); + ::SendMessage(_hSelf, TB_CHECKBUTTON, ID2Check, MAKELONG(willBeChecked, 0)); }; toolBarStatusType getState() const { @@ -131,13 +131,13 @@ private : TiXmlNode *_toolIcons = nullptr; void setDefaultImageList() { - ::SendMessage(_hSelf, TB_SETIMAGELIST , (WPARAM)0, (LPARAM)_toolBarIcons.getDefaultLst()); + ::SendMessage(_hSelf, TB_SETIMAGELIST, 0, reinterpret_cast(_toolBarIcons.getDefaultLst())); }; void setHotImageList() { - ::SendMessage(_hSelf, TB_SETHOTIMAGELIST , (WPARAM)0, (LPARAM)_toolBarIcons.getHotLst()); + ::SendMessage(_hSelf, TB_SETHOTIMAGELIST, 0, reinterpret_cast(_toolBarIcons.getHotLst())); }; void setDisableImageList() { - ::SendMessage(_hSelf, TB_SETDISABLEDIMAGELIST, (WPARAM)0, (LPARAM)_toolBarIcons.getDisableLst()); + ::SendMessage(_hSelf, TB_SETDISABLEDIMAGELIST, 0, reinterpret_cast(_toolBarIcons.getDisableLst())); }; void reset(bool create = false); diff --git a/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp b/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp index 9e77ccd89..1bd8942c8 100644 --- a/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp +++ b/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp @@ -45,7 +45,7 @@ void ToolTip::init(HINSTANCE hInst, HWND hParent) throw std::runtime_error("ToolTip::init : CreateWindowEx() function return null"); } - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _defaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticWinProc))); } } @@ -76,9 +76,9 @@ void ToolTip::Show(RECT rectTitle, const TCHAR * pszTitle, int iXOff, int iWidth // Bleuargh... const_cast. Will have to do for now. _ti.lpszText = const_cast(pszTitle); - ::SendMessage(_hSelf, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &_ti); - ::SendMessage(_hSelf, TTM_TRACKPOSITION, 0, (LPARAM)(DWORD) MAKELONG(_ti.rect.left + iXOff, _ti.rect.top + iWidthOff)); - ::SendMessage(_hSelf, TTM_TRACKACTIVATE, true, (LPARAM)(LPTOOLINFO) &_ti); + ::SendMessage(_hSelf, TTM_ADDTOOL, 0, reinterpret_cast(&_ti)); + ::SendMessage(_hSelf, TTM_TRACKPOSITION, 0, MAKELONG(_ti.rect.left + iXOff, _ti.rect.top + iWidthOff)); + ::SendMessage(_hSelf, TTM_TRACKACTIVATE, true, reinterpret_cast(&_ti)); } diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp index 3cb013f6e..bb7f7443d 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp @@ -43,7 +43,7 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo LVCOLUMN lvc; lvc.mask = LVCF_FMT; - ::SendMessage(pnmListView->hdr.hwndFrom, LVM_GETCOLUMN, (WPARAM)pnmListView->iSubItem, (LPARAM)&lvc); + ::SendMessage(pnmListView->hdr.hwndFrom, LVM_GETCOLUMN, pnmListView->iSubItem, reinterpret_cast(&lvc)); bool isDirectionUp = (HDF_SORTUP & lvc.fmt) != 0; int result = lstrcmp(str1, str2); @@ -128,7 +128,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, nmhdr.code = NM_RCLICK; nmhdr.hwndFrom = _hSelf; nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom); - ::SendMessage(_hParent, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + ::SendMessage(_hParent, WM_NOTIFY, nmhdr.idFrom, reinterpret_cast(&nmhdr)); return TRUE; } @@ -147,7 +147,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, { LPNMLISTVIEW pnmLV = (LPNMLISTVIEW)lParam; setHeaderOrder(pnmLV); - ListView_SortItemsEx(pnmLV->hdr.hwndFrom, ListViewCompareProc,(LPARAM)pnmLV); + ListView_SortItemsEx(pnmLV->hdr.hwndFrom, ListViewCompareProc, reinterpret_cast(pnmLV)); return TRUE; } case LVN_KEYDOWN: @@ -213,7 +213,7 @@ void VerticalFileSwitcher::activateDoc(TaskLstFnStatus *tlfs) const if (bufferID == currentBufID && view == currentView) return; - int docPosInfo = static_cast(::SendMessage(_hParent, NPPM_GETPOSFROMBUFFERID, (WPARAM)bufferID, view)); + int docPosInfo = static_cast(::SendMessage(_hParent, NPPM_GETPOSFROMBUFFERID, reinterpret_cast(bufferID), view)); int view2set = docPosInfo >> 30; int index2Switch = (docPosInfo << 2) >> 2 ; @@ -229,12 +229,12 @@ int VerticalFileSwitcher::setHeaderOrder(LPNMLISTVIEW pnm_list_view) lvc.mask = LVCF_FMT; hListView = pnm_list_view->hdr.hwndFrom; - SendMessage(hListView, LVM_GETCOLUMN, (WPARAM)index, (LPARAM)&lvc); + SendMessage(hListView, LVM_GETCOLUMN, index, reinterpret_cast(&lvc)); if(HDF_SORTUP & lvc.fmt) { //set the opposite arrow lvc.fmt = lvc.fmt & (~HDF_SORTUP) | HDF_SORTDOWN; //turns off sort-up, turns on sort-down - SendMessage(hListView, LVM_SETCOLUMN, (WPARAM) index, (LPARAM) &lvc); + SendMessage(hListView, LVM_SETCOLUMN, index, reinterpret_cast(&lvc)); //use any sorting you would use, e.g. the LVM_SORTITEMS message return SORT_DIRECTION_DOWN; } @@ -243,7 +243,7 @@ int VerticalFileSwitcher::setHeaderOrder(LPNMLISTVIEW pnm_list_view) { //the opposite lvc.fmt = lvc.fmt & (~HDF_SORTDOWN) | HDF_SORTUP; - SendMessage(hListView, LVM_SETCOLUMN, (WPARAM) index, (LPARAM) &lvc); + SendMessage(hListView, LVM_SETCOLUMN, index, reinterpret_cast(&lvc)); return SORT_DIRECTION_UP; } @@ -254,17 +254,17 @@ int VerticalFileSwitcher::setHeaderOrder(LPNMLISTVIEW pnm_list_view) for (q = 0; q < cols; ++q) { //Get current fmt - SendMessage(hListView,LVM_GETCOLUMN,(WPARAM) q, (LPARAM) &lvc); + SendMessage(hListView, LVM_GETCOLUMN, q, reinterpret_cast(&lvc)); //remove both sort-up and sort-down lvc.fmt = lvc.fmt & (~HDF_SORTUP) & (~HDF_SORTDOWN); - SendMessage(hListView,LVM_SETCOLUMN,(WPARAM) q, (LPARAM) &lvc); + SendMessage(hListView, LVM_SETCOLUMN, q, reinterpret_cast(&lvc)); } //read current fmt from clicked column - SendMessage(hListView,LVM_GETCOLUMN,(WPARAM) index, (LPARAM) &lvc); + SendMessage(hListView, LVM_GETCOLUMN, index, reinterpret_cast(&lvc)); // then set whichever arrow you feel like and send LVM_SETCOLUMN to this particular column lvc.fmt = lvc.fmt | HDF_SORTUP; - SendMessage(hListView, LVM_SETCOLUMN, (WPARAM) index, (LPARAM) &lvc); + SendMessage(hListView, LVM_SETCOLUMN, index, reinterpret_cast(&lvc)); return SORT_DIRECTION_UP; } diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp index f211ee99a..b5d7005d8 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp @@ -66,7 +66,7 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null"); } - ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); + ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast(this)); _defaultProc = reinterpret_cast(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast(staticProc))); ListView_SetExtendedListViewStyle(_hSelf, LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | LVS_EX_INFOTIP); @@ -99,7 +99,7 @@ void VerticalFileSwitcherListView::initList() { TaskListInfo taskListInfo; static HWND nppHwnd = ::GetParent(_hParent); - ::SendMessage(nppHwnd, WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE); + ::SendMessage(nppHwnd, WM_GETTASKLISTINFO, reinterpret_cast(&taskListInfo), TRUE); NppParameters *nppParams = NppParameters::getInstance(); NativeLangSpeaker *pNativeSpeaker = nppParams->getNativeLangSpeaker(); @@ -142,7 +142,7 @@ void VerticalFileSwitcherListView::initList() item.iItem = static_cast(i); item.iSubItem = 0; item.iImage = fileNameStatus._status; - item.lParam = (LPARAM)tl; + item.lParam = reinterpret_cast(tl); ListView_InsertItem(_hSelf, &item); if (isExtColumn) { @@ -278,7 +278,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView) item.iItem = index; item.iSubItem = 0; item.iImage = buf->getUserReadOnly()||buf->getFileReadOnly()?2:(buf->isDirty()?1:0); - item.lParam = (LPARAM)tl; + item.lParam = reinterpret_cast(tl); ListView_InsertItem(_hSelf, &item); if (isExtColumn) diff --git a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp index 662a7c7d8..faff01f74 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp @@ -388,9 +388,10 @@ BOOL CWinMgr::SendGetSizeInfo(SIZEINFO& szi, HWND hWnd, UINT nID) nmw.idFrom = nID; // ID of child I'm computing nmw.sizeinfo = szi; // copy - if (!SendMessage(hWnd, WM_WINMGR, nID, (LPARAM)&nmw) && !nmw.processed) { + if (!SendMessage(hWnd, WM_WINMGR, nID, reinterpret_cast(&nmw)) && !nmw.processed) + { HWND hwndChild = ::GetDlgItem(hWnd, nID); - if (!hwndChild || !::SendMessage(hwndChild,WM_WINMGR,nID,(LPARAM)&nmw)) + if (!hwndChild || !::SendMessage(hwndChild, WM_WINMGR, nID, reinterpret_cast(&nmw))) return FALSE; } szi = nmw.sizeinfo; // copy back to caller's struct @@ -421,22 +422,30 @@ void CWinMgr::GetMinMaxInfo(HWND hWnd, SIZEINFO& szi) // Add extra space for frame/dialog screen junk. DWORD dwStyle = GetStyle(hWnd); DWORD dwExStyle = GetExStyle(hWnd); - if (dwStyle & WS_VISIBLE) { + if (dwStyle & WS_VISIBLE) + { SIZE& szMin = szi.szMin; // ref! - if (!(dwStyle & WS_CHILD)) { + if (!(dwStyle & WS_CHILD)) + { if (dwStyle & WS_CAPTION) szMin.cy += GetSystemMetrics(SM_CYCAPTION); if (::GetMenu(hWnd)) szMin.cy += GetSystemMetrics(SM_CYMENU); } - if (dwStyle & WS_THICKFRAME) { + + if (dwStyle & WS_THICKFRAME) + { szMin.cx += 2*GetSystemMetrics(SM_CXSIZEFRAME); szMin.cy += 2*GetSystemMetrics(SM_CYSIZEFRAME); - } else if (dwStyle & WS_BORDER) { + } + else if (dwStyle & WS_BORDER) + { szMin.cx += 2*GetSystemMetrics(SM_CXBORDER); szMin.cy += 2*GetSystemMetrics(SM_CYBORDER); } - if (dwExStyle & WS_EX_CLIENTEDGE) { + + if (dwExStyle & WS_EX_CLIENTEDGE) + { szMin.cx += 2*GetSystemMetrics(SM_CXEDGE); szMin.cy += 2*GetSystemMetrics(SM_CYEDGE); } @@ -459,17 +468,21 @@ void CWinMgr::MoveRect(WINRECT* pwrcMove, POINT ptMove, HWND pParentWnd) RECT& rcNext = next->GetRect(); RECT& rcPrev = prev->GetRect(); - if (bIsRow) { + if (bIsRow) + { // a row can only be moved up or down ptMove.x = 0; rcPrev.bottom += ptMove.y; rcNext.top += ptMove.y; - } else { + } + else + { // a column can only be moved left or right ptMove.y = 0; rcPrev.right += ptMove.x; rcNext.left += ptMove.x; } + OffsetRect(pwrcMove->GetRect(), ptMove); if (prev->IsGroup()) CalcGroup(prev, pParentWnd); diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp index b34db1b89..ea184d067 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp @@ -586,7 +586,7 @@ void WindowsDlg::doRefresh(bool invalidate /*= false*/) _idxMap[i] = int(i); } LPARAM lp = invalidate ? LVSICF_NOSCROLL|LVSICF_NOINVALIDATEALL : LVSICF_NOSCROLL; - ::SendMessage(_hList, LVM_SETITEMCOUNT, (WPARAM)count, lp); + ::SendMessage(_hList, LVM_SETITEMCOUNT, count, lp); ::InvalidateRect(_hList, &_rc, FALSE); resetSelection(); diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp index 94c85cdef..99608d682 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp @@ -42,10 +42,10 @@ void RunMacroDlg::initMacroList() ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0); if (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED) - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro")); + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, reinterpret_cast(TEXT("Current recorded macro"))); for (size_t i = 0, len = macroList.size(); i < len ; ++i) - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i].getName()); + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, reinterpret_cast(macroList[i].getName())); ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0); _macroIndex = 0; diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index 3a0ecb9d0..7d0b6c63b 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -396,7 +396,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) int iFound = -1; for (size_t i = 0 ; i < nrKeys ; ++i) { - ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name); + ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, reinterpret_cast(namedKeyArray[i].name)); if (_keyCombo._key == namedKeyArray[i].id) iFound = static_cast(i); @@ -438,7 +438,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) } if (_canModifyName) { TCHAR editName[nameLenMax]; - ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXT, nameLenMax, (LPARAM)editName); + ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXT, nameLenMax, reinterpret_cast(editName)); setName(editName); } ::EndDialog(_hSelf, 0); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 152231687..ad64dabe0 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -404,8 +404,8 @@ DEVOMER*/ fileNamesData.lpData = (void *)quotFileName.c_str(); fileNamesData.cbData = long(quotFileName.length() + 1)*(sizeof(TCHAR)); - ::SendMessage(hNotepad_plus, WM_COPYDATA, (WPARAM)hInstance, (LPARAM)¶mData); - ::SendMessage(hNotepad_plus, WM_COPYDATA, (WPARAM)hInstance, (LPARAM)&fileNamesData); + ::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast(hInstance), reinterpret_cast(¶mData)); + ::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast(hInstance), reinterpret_cast(&fileNamesData)); } return 0; }