Lost in Translation 3

This commit is contained in:
Don HO 2016-08-11 22:20:30 +02:00
parent a21196d356
commit d4bcec1c01
36 changed files with 161 additions and 164 deletions

View File

@ -589,11 +589,11 @@ generic_string intToString(int val)
// can't use abs here because std::numeric_limits<int>::min() has no positive representation // can't use abs here because std::numeric_limits<int>::min() has no positive representation
//val = std::abs(val); //val = std::abs(val);
vt.push_back('0' + (TCHAR)(std::abs(val % 10))); vt.push_back('0' + static_cast<TCHAR>(std::abs(val % 10)));
val /= 10; val /= 10;
while (val != 0) while (val != 0)
{ {
vt.push_back('0' + (TCHAR)(std::abs(val % 10))); vt.push_back('0' + static_cast<TCHAR>(std::abs(val % 10)));
val /= 10; val /= 10;
} }
@ -608,11 +608,11 @@ generic_string uintToString(unsigned int val)
{ {
std::vector<TCHAR> vt; std::vector<TCHAR> vt;
vt.push_back('0' + (TCHAR)(val % 10)); vt.push_back('0' + static_cast<TCHAR>(val % 10));
val /= 10; val /= 10;
while (val != 0) while (val != 0)
{ {
vt.push_back('0' + (TCHAR)(val % 10)); vt.push_back('0' + static_cast<TCHAR>(val % 10));
val /= 10; val /= 10;
} }
@ -627,7 +627,7 @@ generic_string BuildMenuFileName(int filenameLen, unsigned int pos, const generi
if (pos < 9) if (pos < 9)
{ {
strTemp.push_back('&'); strTemp.push_back('&');
strTemp.push_back('1' + (TCHAR)pos); strTemp.push_back('1' + static_cast<TCHAR>(pos));
} }
else if (pos == 9) else if (pos == 9)
{ {

View File

@ -2448,7 +2448,7 @@ int Notepad_plus::findMachedBracePos(size_t startPos, size_t endPos, char target
int balance = 0; int balance = 0;
for (int i = int(startPos); i >= int(endPos); --i) for (int i = int(startPos); i >= int(endPos); --i)
{ {
char aChar = (char)_pEditView->execute(SCI_GETCHARAT, i); char aChar = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, i));
if (aChar == targetSymbol) if (aChar == targetSymbol)
{ {
if (balance == 0) if (balance == 0)
@ -2892,7 +2892,7 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u)
size_t endpos = _pEditView->execute(SCI_GETLINESELENDPOSITION, j); size_t endpos = _pEditView->execute(SCI_GETLINESELENDPOSITION, j);
for (size_t pos = stpos; pos < endpos; ++pos) for (size_t pos = stpos; pos < endpos; ++pos)
{ {
unsigned char c = 0xf0 & (unsigned char)_pEditView->execute(SCI_GETCHARAT, pos); unsigned char c = 0xf0 & static_cast<unsigned char>(_pEditView->execute(SCI_GETCHARAT, pos));
if (c >= 0xc0) if (c >= 0xc0)
pos += utflen[(c & 0x30) >> 4]; pos += utflen[(c & 0x30) >> 4];
++result; ++result;

View File

@ -811,12 +811,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
if (lParam != 0) if (lParam != 0)
{ {
for (int idx = 0; idx < (int)tli->_tlfsLst.size(); ++idx) for (size_t idx = 0; idx < tli->_tlfsLst.size(); ++idx)
{ {
if (tli->_tlfsLst[idx]._iView == currentView() && if (tli->_tlfsLst[idx]._iView == currentView() &&
tli->_tlfsLst[idx]._docIndex == _pDocTab->getCurrentTabIndex()) tli->_tlfsLst[idx]._docIndex == _pDocTab->getCurrentTabIndex())
{ {
tli->_currentIndex = idx; tli->_currentIndex = static_cast<int>(idx);
break; break;
} }
} }
@ -830,12 +830,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
else else
{ {
for (int idx = 0; idx < (int)tli->_tlfsLst.size(); ++idx) for (size_t idx = 0; idx < tli->_tlfsLst.size(); ++idx)
{ {
if (tli->_tlfsLst[idx]._iView == currentView() && if (tli->_tlfsLst[idx]._iView == currentView() &&
tli->_tlfsLst[idx]._docIndex == _pDocTab->getCurrentTabIndex()) tli->_tlfsLst[idx]._docIndex == _pDocTab->getCurrentTabIndex())
{ {
tli->_currentIndex = idx; tli->_currentIndex = static_cast<int>(idx);
break; break;
} }
} }
@ -1882,7 +1882,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_SETMENUITEMCHECK: case NPPM_SETMENUITEMCHECK:
{ {
::CheckMenuItem(_mainMenuHandle, static_cast<UINT>(wParam), MF_BYCOMMAND | (static_cast<BOOL>(lParam) ? MF_CHECKED : MF_UNCHECKED)); ::CheckMenuItem(_mainMenuHandle, static_cast<UINT>(wParam), MF_BYCOMMAND | (static_cast<BOOL>(lParam) ? MF_CHECKED : MF_UNCHECKED));
_toolBar.setCheck((int)wParam, bool(lParam != 0)); _toolBar.setCheck(static_cast<int>(wParam), lParam != 0);
return TRUE; return TRUE;
} }
@ -2202,7 +2202,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WM_INITMENUPOPUP: case WM_INITMENUPOPUP:
{ {
_windowsMenu.initPopupMenu((HMENU)wParam, _pDocTab); _windowsMenu.initPopupMenu(reinterpret_cast<HMENU>(wParam), _pDocTab);
return TRUE; return TRUE;
} }

View File

@ -1710,7 +1710,7 @@ void NppParameters::initMenuKeys()
for(int i = 0; i < nrCommands; ++i) for(int i = 0; i < nrCommands; ++i)
{ {
wkd = winKeyDefs[i]; wkd = winKeyDefs[i];
Shortcut sc((wkd.specialName?wkd.specialName:TEXT("")), wkd.isCtrl, wkd.isAlt, wkd.isShift, (unsigned char)wkd.vKey); Shortcut sc((wkd.specialName ? wkd.specialName : TEXT("")), wkd.isCtrl, wkd.isAlt, wkd.isShift, static_cast<unsigned char>(wkd.vKey));
_shortcuts.push_back( CommandShortcut(sc, wkd.functionId) ); _shortcuts.push_back( CommandShortcut(sc, wkd.functionId) );
} }
} }
@ -1732,12 +1732,14 @@ void NppParameters::initScintillaKeys() {
kc._isCtrl = skd.isCtrl; kc._isCtrl = skd.isCtrl;
kc._isAlt = skd.isAlt; kc._isAlt = skd.isAlt;
kc._isShift = skd.isShift; kc._isShift = skd.isShift;
kc._key = (unsigned char)skd.vKey; kc._key = static_cast<unsigned char>(skd.vKey);
_scintillaKeyCommands[prevIndex].addKeyCombo(kc); _scintillaKeyCommands[prevIndex].addKeyCombo(kc);
} }
else else
{ {
_scintillaKeyCommands.push_back(ScintillaKeyMap(Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, (unsigned char)skd.vKey), skd.functionId, skd.redirFunctionId)); Shortcut s = Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, static_cast<unsigned char>(skd.vKey));
ScintillaKeyMap sm = ScintillaKeyMap(s, skd.functionId, skd.redirFunctionId);
_scintillaKeyCommands.push_back(sm);
++prevIndex; ++prevIndex;
} }
prevID = skd.functionId; prevID = skd.functionId;
@ -2435,7 +2437,7 @@ void NppParameters::feedScintKeys(TiXmlNode *node)
str = (nextNode->ToElement())->Attribute(TEXT("Key"), &key); str = (nextNode->ToElement())->Attribute(TEXT("Key"), &key);
if (!str) if (!str)
continue; continue;
kc._key = (unsigned char)key; kc._key = static_cast<unsigned char>(key);
_scintillaKeyCommands[i].addKeyCombo(kc); _scintillaKeyCommands[i].addKeyCombo(kc);
} }
break; break;
@ -2490,7 +2492,7 @@ bool NppParameters::getShortcuts(TiXmlNode *node, Shortcut & sc)
if (!keyStr) if (!keyStr)
return false; return false;
sc = Shortcut(name, isCtrl, isAlt, isShift, (unsigned char)key); sc = Shortcut(name, isCtrl, isAlt, isShift, static_cast<unsigned char>(key));
return true; return true;
} }
@ -2902,7 +2904,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
if (root) if (root)
{ {
TiXmlNode *sessionNode = root->InsertEndChild(TiXmlElement(TEXT("Session"))); TiXmlNode *sessionNode = root->InsertEndChild(TiXmlElement(TEXT("Session")));
(sessionNode->ToElement())->SetAttribute(TEXT("activeView"), (int)session._activeView); (sessionNode->ToElement())->SetAttribute(TEXT("activeView"), static_cast<int>(session._activeView));
struct ViewElem { struct ViewElem {
TiXmlNode *viewNode; TiXmlNode *viewNode;
@ -2920,7 +2922,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
for (size_t k = 0; k < nbElem ; ++k) for (size_t k = 0; k < nbElem ; ++k)
{ {
(viewElems[k].viewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)viewElems[k].activeIndex); (viewElems[k].viewNode->ToElement())->SetAttribute(TEXT("activeIndex"), static_cast<int>(viewElems[k].activeIndex));
vector<sessionFileInfo> & viewSessionFiles = *(viewElems[k].viewFiles); vector<sessionFileInfo> & viewSessionFiles = *(viewElems[k].viewFiles);
for (size_t i = 0, len = viewElems[k].viewFiles->size(); i < len ; ++i) for (size_t i = 0, len = viewElems[k].viewFiles->size(); i < len ; ++i)
@ -4637,12 +4639,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
int leftmost = 0; int leftmost = 0;
element->Attribute(TEXT("leftmostDelimiter"), &leftmost); element->Attribute(TEXT("leftmostDelimiter"), &leftmost);
if(leftmost > 0 && leftmost < 256) if(leftmost > 0 && leftmost < 256)
_nppGUI._leftmostDelimiter = (char)leftmost; _nppGUI._leftmostDelimiter = static_cast<char>(leftmost);
int rightmost = 0; int rightmost = 0;
element->Attribute(TEXT("rightmostDelimiter"), &rightmost); element->Attribute(TEXT("rightmostDelimiter"), &rightmost);
if(rightmost > 0 && rightmost < 256) if(rightmost > 0 && rightmost < 256)
_nppGUI._rightmostDelimiter = (char)rightmost; _nppGUI._rightmostDelimiter = static_cast<char>(rightmost);
const TCHAR *delimiterSelectionOnEntireDocument = element->Attribute(TEXT("delimiterSelectionOnEntireDocument")); const TCHAR *delimiterSelectionOnEntireDocument = element->Attribute(TEXT("delimiterSelectionOnEntireDocument"));
if(delimiterSelectionOnEntireDocument != NULL && !lstrcmp(delimiterSelectionOnEntireDocument, TEXT("yes"))) if(delimiterSelectionOnEntireDocument != NULL && !lstrcmp(delimiterSelectionOnEntireDocument, TEXT("yes")))

View File

@ -370,8 +370,8 @@ bool AutoCompletion::showFunctionComplete()
void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t caretPos, bool isHTML) void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t caretPos, bool isHTML)
{ {
char prev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 2); char prev = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, caretPos - 2));
char prevprev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 3); char prevprev = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, caretPos - 3));
// Closing a tag (i.e. "-->") will be ignored // Closing a tag (i.e. "-->") will be ignored
if (prevprev == '-' && prev == '-') if (prevprev == '-' && prev == '-')
@ -484,7 +484,7 @@ int InsertedMatchedChars::search(char startChar, char endChar, int posToDetect)
for (int j = posToDetect; j <= endPos; ++j) for (int j = posToDetect; j <= endPos; ++j)
{ {
char aChar = (char)_pEditView->execute(SCI_GETCHARAT, j); char aChar = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, j));
if (aChar != ' ') // non space is not allowed if (aChar != ' ') // non space is not allowed
{ {
@ -522,8 +522,8 @@ void AutoCompletion::insertMatchedChars(int character, const MatchedPairConf & m
int caretPos = static_cast<int32_t>(_pEditView->execute(SCI_GETCURRENTPOS)); int caretPos = static_cast<int32_t>(_pEditView->execute(SCI_GETCURRENTPOS));
char *matchedChars = NULL; char *matchedChars = NULL;
char charPrev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 2); char charPrev = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, caretPos - 2));
char charNext = (char)_pEditView->execute(SCI_GETCHARAT, caretPos); char charNext = static_cast<char>(_pEditView->execute(SCI_GETCHARAT, caretPos));
bool isCharPrevBlank = (charPrev == ' ' || charPrev == '\t' || charPrev == '\n' || charPrev == '\r' || charPrev == '\0'); bool isCharPrevBlank = (charPrev == ' ' || charPrev == '\t' || charPrev == '\n' || charPrev == '\r' || charPrev == '\0');
int docLen = _pEditView->getCurrentDocLen(); int docLen = _pEditView->getCurrentDocLen();

View File

@ -126,7 +126,7 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
int res = 0; int res = 0;
if (Searching::readBase(query+(i+1), &res, base, size)) if (Searching::readBase(query+(i+1), &res, base, size))
{ {
result[j] = (TCHAR)res; result[j] = static_cast<TCHAR>(res);
i += size; i += size;
break; break;
} }
@ -157,7 +157,7 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
bool Searching::readBase(const TCHAR * str, int * value, int base, int size) { bool Searching::readBase(const TCHAR * str, int * value, int base, int size) {
int i = 0, temp = 0; int i = 0, temp = 0;
*value = 0; *value = 0;
TCHAR max = '0' + (TCHAR)base - 1; TCHAR max = '0' + static_cast<TCHAR>(base) - 1;
TCHAR current; TCHAR current;
while(i < size) { while(i < size) {
current = str[i]; current = str[i];

View File

@ -769,10 +769,10 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.decimalSeparator"), reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.decimalSeparator"), reinterpret_cast<LPARAM>(intBuffer));
// at the end (position SCE_USER_KWLIST_TOTAL) send id values // at the end (position SCE_USER_KWLIST_TOTAL) send id values
itoa((int)userLangContainer->getName(), intBuffer, 10); // use numeric value of TCHAR pointer itoa(reinterpret_cast<int>(userLangContainer->getName()), intBuffer, 10); // use numeric value of TCHAR pointer
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.udlName"), reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.udlName"), reinterpret_cast<LPARAM>(intBuffer));
itoa((int)_currentBufferID, intBuffer, 10); // use numeric value of BufferID pointer itoa(reinterpret_cast<int>(_currentBufferID), intBuffer, 10); // use numeric value of BufferID pointer
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.currentBufferID"), reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.currentBufferID"), reinterpret_cast<LPARAM>(intBuffer));
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i) for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i)

View File

@ -64,12 +64,13 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND); auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND);
// Get the range of text visible and highlight everything in it // Get the range of text visible and highlight everything in it
int firstLine = static_cast<int>(pHighlightView->execute(SCI_GETFIRSTVISIBLELINE)); auto firstLine = static_cast<int>(pHighlightView->execute(SCI_GETFIRSTVISIBLELINE));
int nrLines = min((int)pHighlightView->execute(SCI_LINESONSCREEN), MAXLINEHIGHLIGHT ) + 1; auto nbLineOnScreen = pHighlightView->execute(SCI_LINESONSCREEN);
int lastLine = firstLine + nrLines; auto nrLines = min(nbLineOnScreen, MAXLINEHIGHLIGHT ) + 1;
auto lastLine = firstLine + nrLines;
int startPos = 0; int startPos = 0;
int endPos = 0; int endPos = 0;
int currentLine = firstLine; auto currentLine = firstLine;
int prevDocLineChecked = -1; //invalid start int prevDocLineChecked = -1; //invalid start
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
@ -87,12 +88,12 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
for(; currentLine < lastLine; ++currentLine) for(; currentLine < lastLine; ++currentLine)
{ {
int docLine = (int)pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine); int docLine = static_cast<int>(pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine));
if (docLine == prevDocLineChecked) if (docLine == prevDocLineChecked)
continue; //still on same line (wordwrap) continue; //still on same line (wordwrap)
prevDocLineChecked = docLine; prevDocLineChecked = docLine;
startPos = (int)pHighlightView->execute(SCI_POSITIONFROMLINE, docLine); startPos = static_cast<int>(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine));
endPos = (int)pHighlightView->execute(SCI_POSITIONFROMLINE, docLine+1); endPos = static_cast<int>(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine + 1));
FindReplaceInfo frInfo; FindReplaceInfo frInfo;
frInfo._txt2find = searchText; frInfo._txt2find = searchText;
frInfo._startRange = startPos; frInfo._startRange = startPos;

View File

@ -1240,9 +1240,9 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
//remove current language from langMenu //remove current language from langMenu
HWND hNpp = ::GetParent(_hSelf); HWND hNpp = ::GetParent(_hSelf);
HMENU m = (HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0); HMENU m = reinterpret_cast<HMENU>(::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0));
HMENU subMenu = ::GetSubMenu(m, MENUINDEX_LANGUAGE); HMENU subMenu = ::GetSubMenu(m, MENUINDEX_LANGUAGE);
::RemoveMenu(subMenu, IDM_LANG_USER + UINT(i), MF_BYCOMMAND); ::RemoveMenu(subMenu, static_cast<UINT>(IDM_LANG_USER + i), MF_BYCOMMAND);
::DrawMenuBar(hNpp); ::DrawMenuBar(hNpp);
::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, reinterpret_cast<LPARAM>(langName)); ::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, reinterpret_cast<LPARAM>(langName));
} }
@ -1325,7 +1325,8 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
//add new language name in langMenu //add new language name in langMenu
HWND hNpp = ::GetParent(_hSelf); HWND hNpp = ::GetParent(_hSelf);
::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName); HMENU m = reinterpret_cast<HMENU>(::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0));
::InsertMenu(::GetSubMenu(m, MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName);
::DrawMenuBar(hNpp); ::DrawMenuBar(hNpp);
} }

View File

@ -184,7 +184,7 @@ bool XmlMatchedTagsHighlighter::getXmlMatchedTagsPos(XmlMatchedTagsPos &xmlTags)
// Checking for " or ' is actually wrong here, but it means it works better with invalid XML // Checking for " or ' is actually wrong here, but it means it works better with invalid XML
while(position < docLength && !isWhitespace(nextChar) && nextChar != '/' && nextChar != '>' && nextChar != '\"' && nextChar != '\'') while(position < docLength && !isWhitespace(nextChar) && nextChar != '/' && nextChar != '>' && nextChar != '\"' && nextChar != '\'')
{ {
tagName.push_back((char)nextChar); tagName.push_back(static_cast<char>(nextChar));
++position; ++position;
nextChar = static_cast<int32_t>(_pEditView->execute(SCI_GETCHARAT, position)); nextChar = static_cast<int32_t>(_pEditView->execute(SCI_GETCHARAT, position));
} }
@ -284,7 +284,7 @@ bool XmlMatchedTagsHighlighter::getXmlMatchedTagsPos(XmlMatchedTagsPos &xmlTags)
// Checking for " or ' is actually wrong here, but it means it works better with invalid XML // Checking for " or ' is actually wrong here, but it means it works better with invalid XML
while(position < docLength && !isWhitespace(nextChar) && nextChar != '/' && nextChar != '>' && nextChar != '\"' && nextChar != '\'' ) while(position < docLength && !isWhitespace(nextChar) && nextChar != '/' && nextChar != '>' && nextChar != '\"' && nextChar != '\'' )
{ {
tagName.push_back((char)nextChar); tagName.push_back(static_cast<char>(nextChar));
++position; ++position;
nextChar = static_cast<int32_t>(_pEditView->execute(SCI_GETCHARAT, position)); nextChar = static_cast<int32_t>(_pEditView->execute(SCI_GETCHARAT, position));
} }

View File

@ -47,14 +47,14 @@ void TiXmlBaseA::PutString( const TIXMLA_STRING& str, TIXMLA_STRING* outString )
int c = str[i]; int c = str[i];
if ( c == '&' if ( c == '&'
&& i < ( (int)str.length() - 2 ) && i < ( static_cast<int>(str.length()) - 2 )
&& str[i+1] == '#' && str[i+1] == '#'
&& str[i+2] == 'x' ) && str[i+2] == 'x' )
{ {
// Hexadecimal character reference. // Hexadecimal character reference.
// Pass through unchanged. // Pass through unchanged.
// &#xA9; -- copyright symbol, for example. // &#xA9; -- copyright symbol, for example.
while ( i<(int)str.length() ) while (i < static_cast<int>(str.length()))
{ {
outString->append( str.c_str() + i, 1 ); outString->append( str.c_str() + i, 1 );
++i; ++i;
@ -98,7 +98,7 @@ void TiXmlBaseA::PutString( const TIXMLA_STRING& str, TIXMLA_STRING* outString )
} }
else else
{ {
char realc = (char) c; char realc = static_cast<char>(c);
outString->append( &realc, 1 ); outString->append( &realc, 1 );
++i; ++i;
} }

View File

@ -175,7 +175,7 @@ const char* TiXmlBaseA::SkipWhiteSpace( const char* p )
int c = in->peek(); int c = in->peek();
if ( !IsWhiteSpace( c ) ) if ( !IsWhiteSpace( c ) )
return true; return true;
*tag += (char)in->get(); *tag += static_cast<char>(in->get());
} }
} }
@ -188,7 +188,7 @@ const char* TiXmlBaseA::SkipWhiteSpace( const char* p )
return true; return true;
in->get(); in->get();
*tag += (char)c; *tag += static_cast<char>(c);
} }
return false; return false;
} }
@ -204,7 +204,7 @@ const char* TiXmlBaseA::ReadName( const char* p, TIXMLA_STRING * name )
// hyphens, or colons. (Colons are valid ony for namespaces, // hyphens, or colons. (Colons are valid ony for namespaces,
// but tinyxml can't tell namespaces from names.) // but tinyxml can't tell namespaces from names.)
if ( p && *p if ( p && *p
&& ( isalpha( (unsigned char) *p ) || *p == '_' ) ) && (isalpha(static_cast<unsigned char>(*p)) || *p == '_'))
{ {
while( p && *p while( p && *p
&& ( isalnum( (unsigned char ) *p ) && ( isalnum( (unsigned char ) *p )
@ -240,22 +240,22 @@ const char* TiXmlBaseA::GetEntity( const char* p, char* value )
{ {
// Short, one value entity. // Short, one value entity.
if ( isalpha( *(p+3) ) ) if ( isalpha( *(p+3) ) )
*value += ( (char)tolower( *(p+3) ) - 'a' + 10 ); *value += (static_cast<char>(tolower(*(p + 3))) - 'a' + 10);
else else
*value += ( (char)*(p+3) - '0' ); *value += (static_cast<char>(*(p + 3)) - '0');
return p+5; return p+5;
} }
else else
{ {
// two value entity // two value entity
if ( isalpha( *(p+3) ) ) *value += ((char) tolower( *(p+3) ) - 'a' + 10 ) * 16; if (isalpha(*(p + 3))) *value += (static_cast<char>(tolower(*(p + 3))) - 'a' + 10) * 16;
else *value += ((char) *(p+3) - '0' ) * 16; else *value += (static_cast<char>(*(p + 3)) - '0') * 16;
if ( isalpha( *(p+4) ) ) if ( isalpha( *(p+4) ) )
*value += ((char) tolower( *(p+4) ) - 'a' + 10 ); *value += (static_cast<char>(tolower(*(p + 4))) - 'a' + 10);
else else
*value += ((char) *(p+4) - '0' ); *value += (static_cast<char>(*(p + 4)) - '0');
return p+6; return p+6;
} }
@ -403,7 +403,7 @@ void TiXmlDocumentA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag )
while ( in->good() && in->peek() != '>' ) while ( in->good() && in->peek() != '>' )
{ {
int c = in->get(); int c = in->get();
(*tag) += (char) c; (*tag) += static_cast<char>(c);
} }
if ( in->good() ) if ( in->good() )
@ -597,7 +597,7 @@ void TiXmlElementA::StreamIn (TIXMLA_ISTREAM * in, TIXMLA_STRING * tag)
while( in->good() ) while( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (char) c ; (*tag) += static_cast<char>(c);
if ( c == '>' ) if ( c == '>' )
break; break;
@ -655,7 +655,7 @@ void TiXmlElementA::StreamIn (TIXMLA_ISTREAM * in, TIXMLA_STRING * tag)
if ( c == '>' ) if ( c == '>' )
break; break;
*tag += (char)c; *tag += static_cast<char>(c);
in->get(); in->get();
if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) ) if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
@ -671,7 +671,7 @@ void TiXmlElementA::StreamIn (TIXMLA_ISTREAM * in, TIXMLA_STRING * tag)
{ {
int c = in->get(); int c = in->get();
assert( c == '>' ); assert( c == '>' );
*tag += (char)c; *tag += static_cast<char>(c);
// We are done, once we've found our closing tag. // We are done, once we've found our closing tag.
return; return;
@ -880,7 +880,7 @@ void TiXmlUnknownA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (char)c; (*tag) += static_cast<char>(c);
if ( c == '>' ) if ( c == '>' )
{ {
@ -932,7 +932,7 @@ void TiXmlCommentA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (char)c; (*tag) += static_cast<char>(c);
if ( c == '>' if ( c == '>'
&& tag->at( tag->length() - 2 ) == '-' && tag->at( tag->length() - 2 ) == '-'
@ -1051,7 +1051,7 @@ void TiXmlTextA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag )
if ( c == '<' ) if ( c == '<' )
return; return;
(*tag) += (char)c; (*tag) += static_cast<char>(c);
in->get(); in->get();
} }
} }
@ -1081,7 +1081,7 @@ void TiXmlDeclarationA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (char)c; (*tag) += static_cast<char>(c);
if ( c == '>' ) if ( c == '>' )
{ {

View File

@ -175,7 +175,7 @@ const TCHAR* TiXmlBase::SkipWhiteSpace( const TCHAR* p )
int c = in->peek(); int c = in->peek();
if ( !IsWhiteSpace( c ) ) if ( !IsWhiteSpace( c ) )
return true; return true;
*tag += (TCHAR)in->get(); *tag += static_cast<TCHAR>(in->get());
} }
} }
@ -188,7 +188,7 @@ const TCHAR* TiXmlBase::SkipWhiteSpace( const TCHAR* p )
return true; return true;
in->get(); in->get();
*tag += (TCHAR)c; *tag += static_cast<TCHAR>(c);
} }
return false; return false;
} }
@ -235,7 +235,7 @@ const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
int val; int val;
if (generic_sscanf(p+3, TEXT("%x"), &val) == 1) if (generic_sscanf(p+3, TEXT("%x"), &val) == 1)
{ {
*value = (TCHAR)val; *value = static_cast<TCHAR>(val);
return end + 1; return end + 1;
} }
} }
@ -383,7 +383,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() && in->peek() != '>' ) while ( in->good() && in->peek() != '>' )
{ {
int c = in->get(); int c = in->get();
(*tag) += (TCHAR) c; (*tag) += static_cast<TCHAR>(c);
} }
if ( in->good() ) if ( in->good() )
@ -577,7 +577,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
while( in->good() ) while( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (TCHAR) c ; (*tag) += static_cast<TCHAR>(c);
if ( c == '>' ) if ( c == '>' )
break; break;
@ -635,7 +635,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
if ( c == '>' ) if ( c == '>' )
break; break;
*tag += (TCHAR)c; *tag += static_cast<TCHAR>(c);
in->get(); in->get();
if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) ) if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
@ -651,7 +651,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
{ {
int c = in->get(); int c = in->get();
assert( c == '>' ); assert( c == '>' );
*tag += (TCHAR)c; *tag += static_cast<TCHAR>(c);
// We are done, once we've found our closing tag. // We are done, once we've found our closing tag.
return; return;
@ -860,7 +860,7 @@ void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (TCHAR)c; (*tag) += static_cast<TCHAR>(c);
if ( c == '>' ) if ( c == '>' )
{ {
@ -912,7 +912,7 @@ void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (TCHAR)c; (*tag) += static_cast<TCHAR>(c);
if ( c == '>' if ( c == '>'
&& tag->at( tag->length() - 2 ) == '-' && tag->at( tag->length() - 2 ) == '-'
@ -1031,7 +1031,7 @@ void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
if ( c == '<' ) if ( c == '<' )
return; return;
(*tag) += (TCHAR)c; (*tag) += static_cast<TCHAR>(c);
in->get(); in->get();
} }
} }
@ -1061,7 +1061,7 @@ void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
(*tag) += (TCHAR)c; (*tag) += static_cast<TCHAR>(c);
if ( c == '>' ) if ( c == '>' )
{ {

View File

@ -55,9 +55,9 @@ void ListView::init(HINSTANCE hInst, HWND parent)
0, 0,
0, 0,
_hParent, _hParent,
(HMENU) NULL, nullptr,
hInst, hInst,
NULL); nullptr);
if (!_hSelf) if (!_hSelf)
{ {
throw std::runtime_error("ListView::init : CreateWindowEx() function return null"); throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
@ -205,10 +205,10 @@ void ListView::setValues(int codepage)
item.iSubItem = 0; item.iSubItem = 0;
ListView_InsertItem(_hSelf, &item); ListView_InsertItem(_hSelf, &item);
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)hex); ListView_SetItemText(_hSelf, i, 1, hex);
generic_string s = getAscii((unsigned char)i); generic_string s = getAscii(static_cast<unsigned char>(i));
ListView_SetItemText(_hSelf, i, 2, (LPTSTR)s.c_str()); ListView_SetItemText(_hSelf, i, 2, const_cast<LPTSTR>(s.c_str()));
} }
} }

View File

@ -61,7 +61,7 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (i == -1) if (i == -1)
return TRUE; return TRUE;
insertChar((unsigned char)i); insertChar(static_cast<unsigned char>(i));
return TRUE; return TRUE;
} }
@ -76,7 +76,7 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (i == -1) if (i == -1)
return TRUE; return TRUE;
insertChar((unsigned char)i); insertChar(static_cast<unsigned char>(i));
return TRUE; return TRUE;
} }
default: default:

View File

@ -62,7 +62,7 @@ ClipboardData ClipboardHistoryPanel::getClipboadData()
{ {
for (size_t i = 0 ; i < (*lpLen) ; ++i) for (size_t i = 0 ; i < (*lpLen) ; ++i)
{ {
clipboardData.push_back((unsigned char)lpchar[i]); clipboardData.push_back(static_cast<unsigned char>(lpchar[i]));
} }
GlobalUnlock(hglb); GlobalUnlock(hglb);
} }
@ -73,7 +73,7 @@ ClipboardData ClipboardHistoryPanel::getClipboadData()
int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t); int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t);
for (int i = 0 ; i < nbBytes ; ++i) for (int i = 0 ; i < nbBytes ; ++i)
{ {
clipboardData.push_back((unsigned char)lpchar[i]); clipboardData.push_back(static_cast<unsigned char>(lpchar[i]));
} }
} }
GlobalUnlock(hglb); GlobalUnlock(hglb);

View File

@ -148,8 +148,8 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10; p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10;
p1.y -= 4; p2.y -= 4; p1.y -= 4; p2.y -= 4;
::MoveWindow((HWND)_pFgColour->getHSelf(), p1.x, p1.y, 25, 25, TRUE); ::MoveWindow(reinterpret_cast<HWND>(_pFgColour->getHSelf()), p1.x, p1.y, 25, 25, TRUE);
::MoveWindow((HWND)_pBgColour->getHSelf(), p2.x, p2.y, 25, 25, TRUE); ::MoveWindow(reinterpret_cast<HWND>(_pBgColour->getHSelf()), p2.x, p2.y, 25, 25, TRUE);
_pFgColour->display(); _pFgColour->display();
_pBgColour->display(); _pBgColour->display();

View File

@ -245,51 +245,34 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
void FileBrowser::initPopupMenus() void FileBrowser::initPopupMenus()
{ {
//NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
/*
generic_string removeFolderFromFileBrowser = pNativeSpeaker->getProjectPanelLangMenuStr("FileBrowserContextMenu", IDM_FILEBROWSER_REMOVEROOTFOLDER, FB_REMOVEROOT);
generic_string edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_RENAME, PM_EDITRENAME);
generic_string edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_NEWFOLDER, PM_EDITNEWFOLDER);
generic_string edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_FILEBROWSER_ADDFILES, PM_EDITADDFILES);
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_RENAME, PM_EDITRENAME);
edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_NEWFOLDER, PM_EDITNEWFOLDER);
edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_ADDFILES, PM_EDITADDFILES);
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_FILEBROWSER_DELETEFOLDER, PM_EDITREMOVE);
*/
_hGlobalMenu = ::CreatePopupMenu(); _hGlobalMenu = ::CreatePopupMenu();
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, TEXT("Add")); ::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, TEXT("Add"));
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEALLROOTS, TEXT("Remove All")); ::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEALLROOTS, TEXT("Remove All"));
_hRootMenu = ::CreatePopupMenu(); _hRootMenu = ::CreatePopupMenu();
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, TEXT("Remove")); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, TEXT("Remove"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path")); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files...")); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files..."));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here")); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here")); ::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
_hFolderMenu = ::CreatePopupMenu(); _hFolderMenu = ::CreatePopupMenu();
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path")); ::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files...")); ::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files..."));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here")); ::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here")); ::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
//::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_NEWFOLDER, edit_addfolder.c_str());
//::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDFILES, edit_addfiles.c_str());
_hFileMenu = ::CreatePopupMenu(); _hFileMenu = ::CreatePopupMenu();
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_OPENINNPP, TEXT("Open")); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_OPENINNPP, TEXT("Open"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path")); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_SHELLEXECUTE, TEXT("Run by system")); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_SHELLEXECUTE, TEXT("Run by system"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here")); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here")); ::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_DELETEFILE, edit_remove.c_str());
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_MODIFYFILEPATH, edit_modifyfile.c_str());
} }

View File

@ -95,7 +95,7 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha
(direction == dirDown)?i < totalSize:i >= 0 ; (direction == dirDown)?i < totalSize:i >= 0 ;
(direction == dirDown)?(++i):(--i)) (direction == dirDown)?(++i):(--i))
{ {
if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange) if (static_cast<unsigned char>(content[i]) >= beginRange && static_cast<unsigned char>(content[i]) <= endRange)
{ {
found = i; found = i;
break; break;
@ -110,7 +110,7 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha
(direction == dirDown)?i < totalSize:i >= 0 ; (direction == dirDown)?i < totalSize:i >= 0 ;
(direction == dirDown)?(++i):(--i)) (direction == dirDown)?(++i):(--i))
{ {
if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange) if (static_cast<unsigned char>(content[i]) >= beginRange && static_cast<unsigned char>(content[i]) <= endRange)
{ {
found = i; found = i;
break; break;
@ -164,8 +164,8 @@ bool FindCharsInRangeDlg::getRangeFromUI(unsigned char & startRange, unsigned ch
return false; return false;
if (start > end) if (start > end)
return false; return false;
startRange = (unsigned char)start; startRange = static_cast<unsigned char>(start);
endRange = (unsigned char)end; endRange = static_cast<unsigned char>(end);
return true; return true;
} }

View File

@ -572,7 +572,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
// Create toolbar menu // Create toolbar menu
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS; int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS;
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style, _hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL); 0,0,0,0,_hSelf,nullptr, _hInst, NULL);
oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstToolbarProc))); oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstToolbarProc)));
TBBUTTON tbButtons[3]; TBBUTTON tbButtons[3];

View File

@ -1776,7 +1776,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LPBGcell=(_BGCELL*)wParam; LPBGcell=(_BGCELL*)wParam;
if(OutOfRange(LPBGcell)) if(OutOfRange(LPBGcell))
{ {
wParam=MAKEWPARAM((UINT)GetMenu(hWnd),BGN_OUTOFRANGE); wParam = MAKEWPARAM(reinterpret_cast<UINT>(GetMenu(hWnd)), BGN_OUTOFRANGE);
lParam = 0; lParam = 0;
SendMessage(GetParent(hWnd),WM_COMMAND,wParam,lParam); SendMessage(GetParent(hWnd),WM_COMMAND,wParam,lParam);
ReturnValue = -1; ReturnValue = -1;

View File

@ -44,7 +44,7 @@ void BabyGridWrapper::init(HINSTANCE hInst, HWND parent, int id)
WS_CHILD | WS_VISIBLE | WS_TABSTOP,\ WS_CHILD | WS_VISIBLE | WS_TABSTOP,\
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,\ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,\
_hParent,\ _hParent,\
(HMENU)id,\ reinterpret_cast<HMENU>(id), \
_hInst,\ _hInst,\
(LPVOID)NULL); NULL);
} }

View File

@ -557,7 +557,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// preparing to remove from menu // preparing to remove from menu
posBase = 6; posBase = 6;
nbElem = theMacros.size(); nbElem = theMacros.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO); HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO; modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{ {
@ -590,7 +591,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// preparing to remove from menu // preparing to remove from menu
posBase = 2; posBase = 2;
nbElem = theUserCmds.size(); nbElem = theUserCmds.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN); HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN; modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{ {

View File

@ -1715,7 +1715,8 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
if (LOWORD(wParam)==IDC_BUTTON_REMOVE) if (LOWORD(wParam)==IDC_BUTTON_REMOVE)
{ {
::DeleteMenu((HMENU)::SendMessage(grandParent, NPPM_INTERNAL_GETMENU, 0, 0), lmi._cmdID, MF_BYCOMMAND); HMENU menu2remove = reinterpret_cast<HMENU>(::SendMessage(grandParent, NPPM_INTERNAL_GETMENU, 0, 0));
::DeleteMenu(menu2remove, lmi._cmdID, MF_BYCOMMAND);
} }
else else
{ {
@ -2810,7 +2811,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam,
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
HDC hdcStatic = (HDC) wParam; HDC hdcStatic = (HDC) wParam;
HWND hwnd = (HWND) lParam; HWND hwnd = reinterpret_cast<HWND>(lParam);
if (hwnd == ::GetDlgItem(_hSelf, IDD_STATIC_BLABLA) || hwnd == ::GetDlgItem(_hSelf, IDD_STATIC_BLABLA2NDLINE)) if (hwnd == ::GetDlgItem(_hSelf, IDD_STATIC_BLABLA) || hwnd == ::GetDlgItem(_hSelf, IDD_STATIC_BLABLA2NDLINE))
{ {
COLORREF bgColor = getCtrlBgColor(_hSelf); COLORREF bgColor = getCtrlBgColor(_hSelf);

View File

@ -58,7 +58,7 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
// Create toolbar menu // Create toolbar menu
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST; int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST;
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style, _hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL); 0,0,0,0,_hSelf, nullptr, _hInst, nullptr);
TBBUTTON tbButtons[2]; TBBUTTON tbButtons[2];
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
@ -192,7 +192,7 @@ void ProjectPanel::initMenus()
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, save_workspace.c_str()); ::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, save_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, saveas_workspace.c_str()); ::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, saveas_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, saveacopyas_workspace.c_str()); ::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, saveacopyas_workspace.c_str());
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, (UINT)-1, 0); ::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, newproject_workspace.c_str()); ::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, newproject_workspace.c_str());
generic_string edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY); generic_string edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);

View File

@ -246,7 +246,8 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
if (uc.doDialog() != -1) if (uc.doDialog() != -1)
{ {
HMENU hRunMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN); HMENU mainMenu = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
HMENU hRunMenu = ::GetSubMenu(mainMenu, MENUINDEX_RUN);
int const posBase = 2; int const posBase = 2;
if (nbCmd == 0) if (nbCmd == 0)

View File

@ -78,7 +78,7 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
_partWidthArray.clear(); _partWidthArray.clear();
if (nbParts > 0) if (nbParts > 0)
_partWidthArray.resize(nbParts, (int) defaultPartWidth); _partWidthArray.resize(nbParts, defaultPartWidth);
// Allocate an array for holding the right edge coordinates. // Allocate an array for holding the right edge coordinates.
if (_partWidthArray.size()) if (_partWidthArray.size())

View File

@ -249,7 +249,7 @@ int VerticalFileSwitcher::setHeaderOrder(LPNMLISTVIEW pnm_list_view)
// this is the case our clicked column wasn't the one being sorted up until now // this is the case our clicked column wasn't the one being sorted up until now
// so first we need to iterate through all columns and send LVM_SETCOLUMN to them with fmt set to NOT include these HDFs // so first we need to iterate through all columns and send LVM_SETCOLUMN to them with fmt set to NOT include these HDFs
colHeader = (HWND)SendMessage(hListView,LVM_GETHEADER,0,0); colHeader = reinterpret_cast<HWND>(SendMessage(hListView, LVM_GETHEADER, 0, 0));
cols = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0)); cols = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0));
for (q = 0; q < cols; ++q) for (q = 0; q < cols; ++q)
{ {

View File

@ -58,9 +58,9 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
0, 0,
0, 0,
_hParent, _hParent,
(HMENU) NULL, nullptr,
hInst, hInst,
NULL); nullptr);
if (!_hSelf) if (!_hSelf)
{ {
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null"); throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
@ -112,10 +112,8 @@ void VerticalFileSwitcherListView::initList()
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME); generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
//insertColumn(nameStr.c_str(), 150, 0);
insertColumn(nameStr.c_str(), (isExtColumn ? totalWidth - 50 : totalWidth), 0); insertColumn(nameStr.c_str(), (isExtColumn ? totalWidth - 50 : totalWidth), 0);
//bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn) if (isExtColumn)
{ {
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT); generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);

View File

@ -121,7 +121,7 @@ WINRECT* CWinMgr::FindRect(int nID)
{ {
assert(m_map); assert(m_map);
for (WINRECT* w=m_map; !w->IsEnd(); ++w) { for (WINRECT* w=m_map; !w->IsEnd(); ++w) {
if (w->GetID()==(UINT)nID) if (w->GetID() == static_cast<UINT>(nID))
return w; return w;
} }
return NULL; return NULL;

View File

@ -58,11 +58,11 @@ inline RECT &OffsetRect(RECT& rc, POINT pt) {
// handy functions to take the min or max of a SIZE // handy functions to take the min or max of a SIZE
inline SIZE minsize(SIZE a, SIZE b) { inline SIZE minsize(SIZE a, SIZE b) {
return GetSize(min((UINT)a.cx,(UINT)b.cx),min((UINT)a.cy,(UINT)b.cy)); return GetSize(min(a.cx, b.cx), min(a.cy, b.cy));
} }
inline SIZE maxsize(SIZE a, SIZE b) { inline SIZE maxsize(SIZE a, SIZE b) {
return GetSize(max((UINT)a.cx,(UINT)b.cx),max((UINT)a.cy,(UINT)b.cy)); return GetSize(max(a.cx, b.cx), max(a.cy, b.cy));
} }
////////////////// //////////////////

View File

@ -332,7 +332,8 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str)
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL); HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
const int commandSize = 64; const int commandSize = 64;
TCHAR cmdName[commandSize]; TCHAR cmdName[commandSize];
int nbChar = ::GetMenuString((HMENU)::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0), cmd, cmdName, commandSize, MF_BYCOMMAND); HMENU m = reinterpret_cast<HMENU>(::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0));
int nbChar = ::GetMenuString(m, cmd, cmdName, commandSize, MF_BYCOMMAND);
if (!nbChar) if (!nbChar)
return; return;
bool fin = false; bool fin = false;
@ -387,7 +388,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SetDlgItemText(_hSelf, IDC_NAME_EDIT, getMenuName()); //display the menu name, with ampersands ::SetDlgItemText(_hSelf, IDC_NAME_EDIT, getMenuName()); //display the menu name, with ampersands
if (!_canModifyName) if (!_canModifyName)
::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, EM_SETREADONLY, TRUE, 0); ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, EM_SETREADONLY, TRUE, 0);
int textlen = (int)::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0); auto textlen = ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0);
@ -412,7 +413,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
case WM_COMMAND : case WM_COMMAND :
{ {
int textlen = (int)::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0); auto textlen = ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0);
switch (wParam) switch (wParam)
{ {
case IDC_CTRL_CHECK : case IDC_CTRL_CHECK :
@ -696,14 +697,15 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
} }
} }
void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND menuParent) { void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND menuParent)
{
_hAccelMenu = hMenu; _hAccelMenu = hMenu;
_hMenuParent = menuParent; _hMenuParent = menuParent;
size_t nr = vScintillas->size(); size_t nbScintilla = vScintillas->size();
for(size_t i = 0; i < nr; ++i) { for (size_t i = 0; i < nbScintilla; ++i)
{
_vScintillas.push_back(vScintillas->at(i)); _vScintillas.push_back(vScintillas->at(i));
} }
_nrScintillas = (int)nr;
} }
void ScintillaAccelerator::updateKeys() void ScintillaAccelerator::updateKeys()
@ -712,8 +714,8 @@ void ScintillaAccelerator::updateKeys()
vector<ScintillaKeyMap> & map = pNppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & map = pNppParam->getScintillaKeyList();
size_t mapSize = map.size(); size_t mapSize = map.size();
size_t index; size_t index;
size_t nb = nbScintillas();
for(int i = 0; i < _nrScintillas; ++i) for (size_t i = 0; i < nb; ++i)
{ {
::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0); ::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0);
for(int32_t j = static_cast<int32_t>(mapSize) - 1; j >= 0; j--) //reverse order, top of the list has highest priority for(int32_t j = static_cast<int32_t>(mapSize) - 1; j >= 0; j--) //reverse order, top of the list has highest priority
@ -762,11 +764,12 @@ void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id)
} }
//This procedure uses _keyCombo as a temp. variable to store current settings which can then later be applied (by pressing OK) //This procedure uses _keyCombo as a temp. variable to store current settings which can then later be applied (by pressing OK)
void ScintillaKeyMap::applyToCurrentIndex() { void ScintillaKeyMap::applyToCurrentIndex()
int index = (int)::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0); {
int index = static_cast<int>(::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0));
if (index == LB_ERR) if (index == LB_ERR)
return; return;
setKeyComboByIndex(index, _keyCombo); setKeyComboByIndex(static_cast<int>(index), _keyCombo);
updateListItem(index); updateListItem(index);
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, index, 0); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, index, 0);
@ -898,28 +901,33 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
return TRUE; return TRUE;
} }
case IDC_BUTTON_RMVE: { case IDC_BUTTON_RMVE:
{
if (_size == 1) //cannot delete last shortcut if (_size == 1) //cannot delete last shortcut
return TRUE; return TRUE;
auto i = ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0); auto i = ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0);
removeKeyComboByIndex(i); removeKeyComboByIndex(i);
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_DELETESTRING, i, 0); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_DELETESTRING, i, 0);
if (i == (int)_size) if (static_cast<size_t>(i) == _size)
i = _size - 1; i = _size - 1;
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, i, 0); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, i, 0);
showCurrentSettings(); showCurrentSettings();
validateDialog(); validateDialog();
return TRUE; } return TRUE;
}
case IDC_BUTTON_APPLY: { case IDC_BUTTON_APPLY:
{
applyToCurrentIndex(); applyToCurrentIndex();
validateDialog(); validateDialog();
return TRUE; } return TRUE;
}
default: default:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == LBN_SELCHANGE) if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == LBN_SELCHANGE)
{ {
switch(LOWORD(wParam)) { switch(LOWORD(wParam))
{
case IDC_KEY_COMBO: case IDC_KEY_COMBO:
{ {
auto i = ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_GETCURSEL, 0, 0); auto i = ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_GETCURSEL, 0, 0);

View File

@ -39,7 +39,7 @@ class NppParameters;
void getKeyStrFromVal(UCHAR keyVal, generic_string & str); void getKeyStrFromVal(UCHAR keyVal, generic_string & str);
void getNameStrFromCmd(DWORD cmd, generic_string & str); void getNameStrFromCmd(DWORD cmd, generic_string & str);
static int keyTranslate(int keyIn) { static size_t keyTranslate(size_t keyIn) {
switch (keyIn) { switch (keyIn) {
case VK_DOWN: return SCK_DOWN; case VK_DOWN: return SCK_DOWN;
case VK_UP: return SCK_UP; case VK_UP: return SCK_UP;
@ -204,10 +204,10 @@ public:
}; };
unsigned long getScintillaKeyID() const {return _scintillaKeyID;}; unsigned long getScintillaKeyID() const {return _scintillaKeyID;};
int getMenuCmdID() const {return _menuCmdID;}; int getMenuCmdID() const {return _menuCmdID;};
int toKeyDef(size_t index) const { size_t toKeyDef(size_t index) const {
KeyCombo kc = _keyCombos[index]; KeyCombo kc = _keyCombos[index];
int keymod = (kc._isCtrl?SCMOD_CTRL:0) | (kc._isAlt?SCMOD_ALT:0) | (kc._isShift?SCMOD_SHIFT:0); int keymod = (kc._isCtrl?SCMOD_CTRL:0) | (kc._isAlt?SCMOD_ALT:0) | (kc._isShift?SCMOD_SHIFT:0);
return keyTranslate((int)kc._key) + (keymod << 16); return keyTranslate(kc._key) + (keymod << 16);
}; };
KeyCombo getKeyComboByIndex(size_t index) const; KeyCombo getKeyComboByIndex(size_t index) const;
@ -373,15 +373,15 @@ private:
class ScintillaAccelerator { //Handles accelerator keys for scintilla class ScintillaAccelerator { //Handles accelerator keys for scintilla
public: public:
ScintillaAccelerator() : _nrScintillas(0) {}; ScintillaAccelerator() {};
void init(std::vector<HWND> * vScintillas, HMENU hMenu, HWND menuParent); void init(std::vector<HWND> * vScintillas, HMENU hMenu, HWND menuParent);
void updateKeys(); void updateKeys();
void updateKey(ScintillaKeyMap skmOld, ScintillaKeyMap skm); void updateKey(ScintillaKeyMap skmOld, ScintillaKeyMap skm);
size_t nbScintillas() { return _vScintillas.size(); };
private: private:
HMENU _hAccelMenu; HMENU _hAccelMenu = nullptr;
HWND _hMenuParent; HWND _hMenuParent = nullptr;
std::vector<HWND> _vScintillas; std::vector<HWND> _vScintillas;
int _nrScintillas;
void updateMenuItemByID(ScintillaKeyMap skm, int id); void updateMenuItemByID(ScintillaKeyMap skm, int id);
}; };

View File

@ -199,7 +199,7 @@ void LastRecentFileList::remove(size_t index)
{ {
if (_size == 0 || _locked) if (_size == 0 || _locked)
return; return;
if (index > -1 && index < (int)_lrfl.size()) if (index < _lrfl.size())
{ {
::RemoveMenu(_hMenu, _lrfl.at(index)._id, MF_BYCOMMAND); ::RemoveMenu(_hMenu, _lrfl.at(index)._id, MF_BYCOMMAND);
setAvailable(_lrfl.at(index)._id); setAvailable(_lrfl.at(index)._id);

View File

@ -132,8 +132,8 @@ protected:
// first byte range: 0xc4 -- 0xfe // first byte range: 0xc4 -- 0xfe
// second byte range: 0xa1 -- 0xfe // second byte range: 0xa1 -- 0xfe
//no validation needed here. State machine has done that //no validation needed here. State machine has done that
PRInt32 GetOrder(const char* str) PRInt32 GetOrder(const char* str) {
{ if ((unsigned char)*str >= (unsigned char)0xc4) if ((unsigned char)*str >= (unsigned char)0xc4)
return 94*((unsigned char)str[0]-(unsigned char)0xc4) + (unsigned char)str[1] - (unsigned char)0xa1; return 94*((unsigned char)str[0]-(unsigned char)0xc4) + (unsigned char)str[1] - (unsigned char)0xa1;
else else
return -1; return -1;

View File

@ -523,7 +523,7 @@ DEVOMER*/
{ {
TCHAR message[1024]; //TODO: sane number TCHAR message[1024]; //TODO: sane number
wsprintf(message, TEXT("An exception occured. Notepad++ cannot recover and must be shut down.\r\nThe exception details are as follows:\r\n") wsprintf(message, TEXT("An exception occured. Notepad++ cannot recover and must be shut down.\r\nThe exception details are as follows:\r\n")
TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), (long)ex.where()); TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), reinterpret_cast<long>(ex.where()));
::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR); ::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
mdump.writeDump(ex.info()); mdump.writeDump(ex.info());
doException(notepad_plus_plus); doException(notepad_plus_plus);
@ -539,5 +539,5 @@ DEVOMER*/
doException(notepad_plus_plus); doException(notepad_plus_plus);
} }
return (UINT)msg.wParam; return static_cast<int>(msg.wParam);
} }