Use unary operator '!' instead of "not"

This commit is contained in:
Don HO 2021-02-20 04:44:34 +01:00
parent 1eaaf45d87
commit dbac42edd0
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
19 changed files with 109 additions and 109 deletions

View File

@ -616,21 +616,21 @@ generic_string PathAppend(generic_string& strDest, const generic_string& str2app
return strDest; return strDest;
} }
if (strDest.empty() && not str2append.empty()) // "" + titi if (strDest.empty() && !str2append.empty()) // "" + titi
{ {
strDest = str2append; strDest = str2append;
return strDest; return strDest;
} }
if (strDest[strDest.length() - 1] == '\\' && (not str2append.empty() && str2append[0] == '\\')) // toto\ + \titi if (strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] == '\\')) // toto\ + \titi
{ {
strDest.erase(strDest.length() - 1, 1); strDest.erase(strDest.length() - 1, 1);
strDest += str2append; strDest += str2append;
return strDest; return strDest;
} }
if ((strDest[strDest.length() - 1] == '\\' && (not str2append.empty() && str2append[0] != '\\')) // toto\ + titi if ((strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] != '\\')) // toto\ + titi
|| (strDest[strDest.length() - 1] != '\\' && (not str2append.empty() && str2append[0] == '\\'))) // toto + \titi || (strDest[strDest.length() - 1] != '\\' && (!str2append.empty() && str2append[0] == '\\'))) // toto + \titi
{ {
strDest += str2append; strDest += str2append;
return strDest; return strDest;
@ -945,7 +945,7 @@ bool allPatternsAreExclusion(const std::vector<generic_string> patterns)
break; break;
} }
} }
return not oneInclusionPatternFound; return !oneInclusionPatternFound;
} }
generic_string GetLastErrorAsString(DWORD errorCode) generic_string GetLastErrorAsString(DWORD errorCode)
@ -1087,7 +1087,7 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
CertInfo.SerialNumber = pSignerInfo->SerialNumber; CertInfo.SerialNumber = pSignerInfo->SerialNumber;
pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_CERT, (PVOID)&CertInfo, NULL); pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_CERT, (PVOID)&CertInfo, NULL);
if (not pCertContext) if (!pCertContext)
{ {
generic_string errorMessage = TEXT("Certificate context: "); generic_string errorMessage = TEXT("Certificate context: ");
errorMessage += GetLastErrorAsString(GetLastError()); errorMessage += GetLastErrorAsString(GetLastError());

View File

@ -271,8 +271,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_mainEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine); _mainEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine); _subEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
if (svp1._doSmoothFont) if (svp1._doSmoothFont)
{ {
@ -1708,7 +1708,7 @@ bool Notepad_plus::findInFiles()
{ {
const TCHAR *dir2Search = _findReplaceDlg.getDir2Search(); const TCHAR *dir2Search = _findReplaceDlg.getDir2Search();
if (not dir2Search[0] || not ::PathFileExists(dir2Search)) if (!dir2Search[0] || !::PathFileExists(dir2Search))
{ {
return false; return false;
} }
@ -2098,7 +2098,7 @@ void Notepad_plus::checkDocState()
bool isSysReadOnly = curBuf->getFileReadOnly(); bool isSysReadOnly = curBuf->getFileReadOnly();
enableCommand(IDM_EDIT_CLEARREADONLY, isSysReadOnly, MENU); enableCommand(IDM_EDIT_CLEARREADONLY, isSysReadOnly, MENU);
bool doEnable = not (curBuf->isMonitoringOn() || isSysReadOnly); bool doEnable = !(curBuf->isMonitoringOn() || isSysReadOnly);
enableCommand(IDM_EDIT_SETREADONLY, doEnable, MENU); enableCommand(IDM_EDIT_SETREADONLY, doEnable, MENU);
bool isUserReadOnly = curBuf->getUserReadOnly(); bool isUserReadOnly = curBuf->getUserReadOnly();
@ -2124,7 +2124,7 @@ void Notepad_plus::checkDocState()
if (_pAnsiCharPanel) if (_pAnsiCharPanel)
_pAnsiCharPanel->switchEncoding(); _pAnsiCharPanel->switchEncoding();
enableCommand(IDM_VIEW_MONITORING, not curBuf->isUntitled(), MENU | TOOLBAR); enableCommand(IDM_VIEW_MONITORING, !curBuf->isUntitled(), MENU | TOOLBAR);
checkMenuItem(IDM_VIEW_MONITORING, curBuf->isMonitoringOn()); checkMenuItem(IDM_VIEW_MONITORING, curBuf->isMonitoringOn());
_toolBar.setCheck(IDM_VIEW_MONITORING, curBuf->isMonitoringOn()); _toolBar.setCheck(IDM_VIEW_MONITORING, curBuf->isMonitoringOn());
} }
@ -3181,14 +3181,14 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
BOOL Notepad_plus::processFindAccel(MSG *msg) const BOOL Notepad_plus::processFindAccel(MSG *msg) const
{ {
if (not ::IsChild(_findReplaceDlg.getHSelf(), ::GetFocus())) if (!::IsChild(_findReplaceDlg.getHSelf(), ::GetFocus()))
return FALSE; return FALSE;
return ::TranslateAccelerator(_findReplaceDlg.getHSelf(), _accelerator.getFindAccTable(), msg); return ::TranslateAccelerator(_findReplaceDlg.getHSelf(), _accelerator.getFindAccTable(), msg);
} }
BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const
{ {
if (not ::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus())) if (!::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus()))
return FALSE; return FALSE;
return ::TranslateAccelerator(_incrementFindDlg.getHSelf(), _accelerator.getIncrFindAccTable(), msg); return ::TranslateAccelerator(_incrementFindDlg.getHSelf(), _accelerator.getIncrFindAccTable(), msg);
} }
@ -3786,7 +3786,7 @@ void Notepad_plus::dropFiles(HDROP hdrop)
switchToFile(lastOpened); switchToFile(lastOpened);
} }
} }
else if (not isOldMode && (folderPaths.size() != 0 && filePaths.size() != 0)) // new mode && both folders & files else if (!isOldMode && (folderPaths.size() != 0 && filePaths.size() != 0)) // new mode && both folders & files
{ {
// display error & do nothing // display error & do nothing
_nativeLangSpeaker.messageBox("DroppingFolderAsProjectModeWarning", _nativeLangSpeaker.messageBox("DroppingFolderAsProjectModeWarning",
@ -3795,7 +3795,7 @@ void Notepad_plus::dropFiles(HDROP hdrop)
TEXT("Invalid action"), TEXT("Invalid action"),
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
} }
else if (not isOldMode && (folderPaths.size() != 0 && filePaths.size() == 0)) // new mode && only folders else if (!isOldMode && (folderPaths.size() != 0 && filePaths.size() == 0)) // new mode && only folders
{ {
// process new mode // process new mode
generic_string emptyStr; generic_string emptyStr;
@ -4627,7 +4627,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
const TCHAR aSpace[] { TEXT(" ") }; const TCHAR aSpace[] { TEXT(" ") };
//Only values that have passed through will be assigned, to be sure they are valid! //Only values that have passed through will be assigned, to be sure they are valid!
if (not isSingleLineAdvancedMode) if (!isSingleLineAdvancedMode)
{ {
comment = commentLineSymbol; comment = commentLineSymbol;
@ -4690,7 +4690,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (currCommentMode != cm_comment) // uncomment/toggle if (currCommentMode != cm_comment) // uncomment/toggle
{ {
if (not isSingleLineAdvancedMode) if (!isSingleLineAdvancedMode)
{ {
// In order to do get case insensitive comparison use strnicmp() instead case-sensitive comparison. // In order to do get case insensitive comparison use strnicmp() instead case-sensitive comparison.
// Case insensitive comparison is needed e.g. for "REM" and "rem" in Batchfiles. // Case insensitive comparison is needed e.g. for "REM" and "rem" in Batchfiles.
@ -4778,7 +4778,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (currCommentMode != cm_uncomment) // comment/toggle if (currCommentMode != cm_uncomment) // comment/toggle
{ {
if (not isSingleLineAdvancedMode) if (!isSingleLineAdvancedMode)
{ {
_pEditView->insertGenericTextFrom(lineIndent, comment.c_str()); _pEditView->insertGenericTextFrom(lineIndent, comment.c_str());

View File

@ -239,7 +239,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
const int strSize = FINDREPLACE_MAXLENGTH; const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize]; TCHAR str[strSize];
bool isFirstTime = not _findReplaceDlg.isCreated(); bool isFirstTime = !_findReplaceDlg.isCreated();
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL()); _findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL());
const NppGUI & nppGui = nppParam.getNppGUI(); const NppGUI & nppGui = nppParam.getNppGUI();
@ -263,7 +263,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
TCHAR str[strSize]; TCHAR str[strSize];
Finder *launcher = reinterpret_cast<Finder *>(wParam); Finder *launcher = reinterpret_cast<Finder *>(wParam);
bool isFirstTime = not _findInFinderDlg.isCreated(); bool isFirstTime = !_findInFinderDlg.isCreated();
_findInFinderDlg.doDialog(launcher, _nativeLangSpeaker.isRTL()); _findInFinderDlg.doDialog(launcher, _nativeLangSpeaker.isRTL());
@ -1360,7 +1360,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_FINDKEYCONFLICTS: case NPPM_INTERNAL_FINDKEYCONFLICTS:
{ {
if (not wParam || not lParam) // Clean up current session if (!wParam || !lParam) // Clean up current session
{ {
delete _pShortcutMapper; delete _pShortcutMapper;
_pShortcutMapper = nullptr; _pShortcutMapper = nullptr;

View File

@ -1496,7 +1496,7 @@ bool Notepad_plus::fileSave(BufferID id)
TCHAR *name = ::PathFindFileName(fn); TCHAR *name = ::PathFindFileName(fn);
generic_string fn_bak; generic_string fn_bak;
if (nppgui._useDir && not nppgui._backupDir.empty()) if (nppgui._useDir && !nppgui._backupDir.empty())
{ {
// Get the custom directory, make sure it has a trailing slash // Get the custom directory, make sure it has a trailing slash
fn_bak = nppgui._backupDir; fn_bak = nppgui._backupDir;

View File

@ -46,7 +46,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{ {
case SCN_MODIFIED: case SCN_MODIFIED:
{ {
if (not notifyView) if (!notifyView)
return FALSE; return FALSE;
static bool prevWasEdit = false; static bool prevWasEdit = false;
@ -549,7 +549,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_tabPopupMenu.checkItem(IDM_EDIT_SETREADONLY, isUserReadOnly); _tabPopupMenu.checkItem(IDM_EDIT_SETREADONLY, isUserReadOnly);
bool isSysReadOnly = buf->getFileReadOnly(); bool isSysReadOnly = buf->getFileReadOnly();
_tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, not isSysReadOnly && not buf->isMonitoringOn()); _tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, !isSysReadOnly && !buf->isMonitoringOn());
_tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly); _tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly);
bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE; bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
@ -659,7 +659,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_DOUBLECLICK: case SCN_DOUBLECLICK:
{ {
if (not notifyView) if (!notifyView)
return FALSE; return FALSE;
if (notification->modifiers == SCMOD_CTRL) if (notification->modifiers == SCMOD_CTRL)
@ -835,7 +835,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_UPDATEUI: case SCN_UPDATEUI:
{ {
if (not notifyView) if (!notifyView)
return FALSE; return FALSE;
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
@ -962,7 +962,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_ZOOM: case SCN_ZOOM:
{ {
if (not notifyView) if (!notifyView)
return FALSE; return FALSE;
ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView; ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView;
@ -985,7 +985,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_PAINTED: case SCN_PAINTED:
{ {
if (not notifyView) if (!notifyView)
return FALSE; return FALSE;
// Check if a restore position is needed. // Check if a restore position is needed.
@ -1021,7 +1021,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_linkTriggered = false; _linkTriggered = false;
} }
if (_pDocMap && (not _pDocMap->isClosed()) && _pDocMap->isVisible() && not _pDocMap->isTemporarilyShowing()) if (_pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible() && !_pDocMap->isTemporarilyShowing())
{ {
_pDocMap->wrapMap(); _pDocMap->wrapMap();
_pDocMap->scrollMap(); _pDocMap->scrollMap();

View File

@ -709,7 +709,7 @@ bool LocalizationSwitcher::addLanguageFromXml(const std::wstring& xmlFullPath)
{ {
wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str()); wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str());
wstring foundLang = getLangFromXmlFileName(fn); wstring foundLang = getLangFromXmlFileName(fn);
if (not foundLang.empty()) if (!foundLang.empty())
{ {
_localizationList.push_back(pair<wstring, wstring>(foundLang, xmlFullPath)); _localizationList.push_back(pair<wstring, wstring>(foundLang, xmlFullPath));
return true; return true;
@ -1311,7 +1311,7 @@ bool NppParameters::load()
// LocalizationSwitcher should use always user path // LocalizationSwitcher should use always user path
_localizationSwitcher._nativeLangPath = nativeLangPath; _localizationSwitcher._nativeLangPath = nativeLangPath;
if (not _startWithLocFileName.empty()) // localization argument detected, use user wished localization if (!_startWithLocFileName.empty()) // localization argument detected, use user wished localization
{ {
// overwrite nativeLangPath variable // overwrite nativeLangPath variable
nativeLangPath = _nppPath; nativeLangPath = _nppPath;
@ -1681,7 +1681,7 @@ bool NppParameters::getUserParametersFromXmlTree()
return false; return false;
TiXmlNode *root = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *root = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not root) if (!root)
return false; return false;
// Get GUI parameters // Get GUI parameters
@ -1980,7 +1980,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT(""); menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT(""); menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
if (not menuEntryName.empty() and not menuItemName.empty()) if (!menuEntryName.empty() && !menuItemName.empty())
{ {
int cmd = getCmdIdFromMenuEntryItemName(mainMenuHadle, menuEntryName, menuItemName); int cmd = getCmdIdFromMenuEntryItemName(mainMenuHadle, menuEntryName, menuItemName);
if (cmd != -1) if (cmd != -1)
@ -1997,7 +1997,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT(""); pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid // if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty()) if (pluginsMenu && !pluginName.empty() && !pluginCmdName.empty())
{ {
int pluginCmdId = getPluginCmdIdFromMenuEntryItemName(pluginsMenu, pluginName, pluginCmdName); int pluginCmdId = getPluginCmdIdFromMenuEntryItemName(pluginsMenu, pluginName, pluginCmdName);
if (pluginCmdId != -1) if (pluginCmdId != -1)
@ -3247,9 +3247,9 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
void NppParameters::writeShortcuts() void NppParameters::writeShortcuts()
{ {
if (not _isAnyShortcutModified) return; if (!_isAnyShortcutModified) return;
if (not _pXmlShortcutDoc) if (!_pXmlShortcutDoc)
{ {
//do the treatment //do the treatment
_pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath); _pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath);
@ -3689,16 +3689,16 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const
{ {
if (not _pXmlUserDoc) return false; if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History")); TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History"));
if (not historyNode) if (!historyNode)
{ {
historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History"))); historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History")));
} }
@ -3714,7 +3714,7 @@ bool NppParameters::writeProjectPanelsSettings() const
if (!_pXmlUserDoc) return false; if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
@ -3749,7 +3749,7 @@ bool NppParameters::writeFileBrowserSettings(const vector<generic_string> & root
if (!_pXmlUserDoc) return false; if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
@ -3787,13 +3787,13 @@ bool NppParameters::writeFileBrowserSettings(const vector<generic_string> & root
bool NppParameters::writeHistory(const TCHAR *fullpath) bool NppParameters::writeHistory(const TCHAR *fullpath)
{ {
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History")); TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History"));
if (not historyNode) if (!historyNode)
{ {
historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History"))); historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History")));
} }
@ -5704,19 +5704,19 @@ bool NppParameters::writeScintillaParams()
const TCHAR *pViewName = TEXT("ScintillaPrimaryView"); const TCHAR *pViewName = TEXT("ScintillaPrimaryView");
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
TiXmlNode *configsRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs")); TiXmlNode *configsRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs"));
if (not configsRoot) if (!configsRoot)
{ {
configsRoot = nppRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfigs"))); configsRoot = nppRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfigs")));
} }
TiXmlNode *scintNode = getChildElementByAttribut(configsRoot, TEXT("GUIConfig"), TEXT("name"), pViewName); TiXmlNode *scintNode = getChildElementByAttribut(configsRoot, TEXT("GUIConfig"), TEXT("name"), pViewName);
if (not scintNode) if (!scintNode)
{ {
scintNode = configsRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))); scintNode = configsRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig")));
(scintNode->ToElement())->SetAttribute(TEXT("name"), pViewName); (scintNode->ToElement())->SetAttribute(TEXT("name"), pViewName);
@ -6274,10 +6274,10 @@ void NppParameters::createXmlTreeFromGUIParams()
bool NppParameters::writeFindHistory() bool NppParameters::writeFindHistory()
{ {
if (not _pXmlUserDoc) return false; if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }

View File

@ -220,14 +220,14 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
bool isWow64Off = false; bool isWow64Off = false;
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (not PathFileExists(_fullPathName.c_str())) if (!PathFileExists(_fullPathName.c_str()))
{ {
nppParam.safeWow64EnableWow64FsRedirection(FALSE); nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true; isWow64Off = true;
} }
bool isOK = false; bool isOK = false;
if (_currentStatus != DOC_DELETED && not PathFileExists(_fullPathName.c_str())) //document has been deleted if (_currentStatus != DOC_DELETED && !PathFileExists(_fullPathName.c_str())) //document has been deleted
{ {
_currentStatus = DOC_DELETED; _currentStatus = DOC_DELETED;
_isFileReadOnly = false; _isFileReadOnly = false;
@ -917,7 +917,7 @@ bool FileManager::backupCurrentBuffer()
else // buffer not dirty, sync: delete the backup file else // buffer not dirty, sync: delete the backup file
{ {
generic_string backupFilePath = buffer->getBackupFileName(); generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty()) if (!backupFilePath.empty())
{ {
// delete backup file // delete backup file
generic_string file2Delete = buffer->getBackupFileName(); generic_string file2Delete = buffer->getBackupFileName();
@ -945,7 +945,7 @@ bool FileManager::deleteBufferBackup(BufferID id)
Buffer* buffer = getBufferByID(id); Buffer* buffer = getBufferByID(id);
bool result = true; bool result = true;
generic_string backupFilePath = buffer->getBackupFileName(); generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty()) if (!backupFilePath.empty())
{ {
// delete backup file // delete backup file
buffer->setBackupFileName(generic_string()); buffer->setBackupFileName(generic_string());
@ -1062,7 +1062,7 @@ SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool i
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault); _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
generic_string backupFilePath = buffer->getBackupFileName(); generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty()) if (!backupFilePath.empty())
{ {
// delete backup file // delete backup file
buffer->setBackupFileName(generic_string()); buffer->setBackupFileName(generic_string());
@ -1260,7 +1260,7 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data,
bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat) bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
{ {
FILE *fp = generic_fopen(filename, TEXT("rb")); FILE *fp = generic_fopen(filename, TEXT("rb"));
if (not fp) if (!fp)
return false; return false;
//Get file size //Get file size

View File

@ -589,13 +589,13 @@ vector<generic_string> Finder::getResultFilePaths() const
// make sure that path is not already in // make sure that path is not already in
generic_string & path2add = (*_pMainFoundInfos)[i]._fullPath; generic_string & path2add = (*_pMainFoundInfos)[i]._fullPath;
bool found = path2add.empty(); bool found = path2add.empty();
for (size_t j = 0; j < paths.size() && not found; ++j) for (size_t j = 0; j < paths.size() && !found; ++j)
{ {
if (paths[j] == path2add) if (paths[j] == path2add)
found = true; found = true;
} }
if (not found) if (!found)
paths.push_back(path2add); paths.push_back(path2add);
} }
return paths; return paths;
@ -2038,7 +2038,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
{ {
int nbProcessed = 0; int nbProcessed = 0;
if (!isCreated() && not findReplaceInfo._txt2find) if (!isCreated() && !findReplaceInfo._txt2find)
return nbProcessed; return nbProcessed;
ScintillaEditView *pEditView = *_ppEditView; ScintillaEditView *pEditView = *_ppEditView;
@ -2057,7 +2057,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
LRESULT stringSizeReplace = 0; LRESULT stringSizeReplace = 0;
TCHAR *pTextFind = NULL; TCHAR *pTextFind = NULL;
if (not findReplaceInfo._txt2find) if (!findReplaceInfo._txt2find)
{ {
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
generic_string str2Search = getTextFromCombo(hFindCombo); generic_string str2Search = getTextFromCombo(hFindCombo);
@ -2081,7 +2081,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
TCHAR *pTextReplace = NULL; TCHAR *pTextReplace = NULL;
if (op == ProcessReplaceAll) if (op == ProcessReplaceAll)
{ {
if (not findReplaceInfo._txt2replace) if (!findReplaceInfo._txt2replace)
{ {
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH); HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
generic_string str2Replace = getTextFromCombo(hReplaceCombo); generic_string str2Replace = getTextFromCombo(hReplaceCombo);
@ -2193,7 +2193,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
case ProcessFindInFinder: case ProcessFindInFinder:
{ {
if (not pFindersInfo || not pFindersInfo->_pSourceFinder || not pFindersInfo->_pDestFinder) if (!pFindersInfo || !pFindersInfo->_pSourceFinder || !pFindersInfo->_pDestFinder)
break; break;
const TCHAR *pFileName = pFindersInfo->_pFileName ? pFindersInfo->_pFileName : TEXT(""); const TCHAR *pFileName = pFindersInfo->_pFileName ? pFindersInfo->_pFileName : TEXT("");

View File

@ -86,13 +86,13 @@ void FunctionCallTip::setLanguageXML(TiXmlElement * pXmlKeyword)
bool FunctionCallTip::updateCalltip(int ch, bool needShown) bool FunctionCallTip::updateCalltip(int ch, bool needShown)
{ {
if (not needShown && ch != _start && ch != _param && not isVisible()) //must be already visible if (!needShown && ch != _start && ch != _param && !isVisible()) //must be already visible
return false; return false;
_curPos = static_cast<int32_t>(_pEditView->execute(SCI_GETCURRENTPOS)); _curPos = static_cast<int32_t>(_pEditView->execute(SCI_GETCURRENTPOS));
//recalculate everything //recalculate everything
if (not getCursorFunction()) if (!getCursorFunction())
{ //cannot display calltip (anymore) { //cannot display calltip (anymore)
close(); close();
return false; return false;

View File

@ -1312,13 +1312,13 @@ void ScintillaEditView::addCustomWordChars()
break; break;
} }
} }
if (not found) if (!found)
{ {
chars2addStr.push_back(char2check); chars2addStr.push_back(char2check);
} }
} }
if (not chars2addStr.empty()) if (!chars2addStr.empty())
{ {
string newCharList = _defaultCharList; string newCharList = _defaultCharList;
newCharList += chars2addStr; newCharList += chars2addStr;
@ -1837,7 +1837,7 @@ void ScintillaEditView::restoreCurrentPosPreStep()
execute(SCI_SETANCHOR, pos._startPos); execute(SCI_SETANCHOR, pos._startPos);
execute(SCI_SETCURRENTPOS, pos._endPos); execute(SCI_SETCURRENTPOS, pos._endPos);
execute(SCI_CANCEL); //disable execute(SCI_CANCEL); //disable
if (not isWrap()) //only offset if not wrapping, otherwise the offset isnt needed at all if (!isWrap()) //only offset if not wrapping, otherwise the offset isnt needed at all
{ {
execute(SCI_SETSCROLLWIDTH, pos._scrollWidth); execute(SCI_SETSCROLLWIDTH, pos._scrollWidth);
execute(SCI_SETXOFFSET, pos._xOffset); execute(SCI_SETXOFFSET, pos._xOffset);
@ -2877,7 +2877,7 @@ void ScintillaEditView::changeCase(__inout wchar_t * const strWToConvert, const
{ {
if (::IsCharAlphaW(strWToConvert[i])) if (::IsCharAlphaW(strWToConvert[i]))
{ {
if ((i < 1) ? true : not ::IsCharAlphaNumericW(strWToConvert[i - 1])) if ((i < 1) ? true : !::IsCharAlphaNumericW(strWToConvert[i - 1]))
strWToConvert[i] = (WCHAR)(UINT_PTR)::CharUpperW((LPWSTR)strWToConvert[i]); strWToConvert[i] = (WCHAR)(UINT_PTR)::CharUpperW((LPWSTR)strWToConvert[i]);
else if (caseToConvert == TITLECASE_FORCE) else if (caseToConvert == TITLECASE_FORCE)
strWToConvert[i] = (WCHAR)(UINT_PTR)::CharLowerW((LPWSTR)strWToConvert[i]); strWToConvert[i] = (WCHAR)(UINT_PTR)::CharLowerW((LPWSTR)strWToConvert[i]);

View File

@ -84,7 +84,7 @@ void ListView::destroy()
void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam, int pos2insert) void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam, int pos2insert)
{ {
if (not values2Add.size()) if (!values2Add.size())
return; return;
if (pos2insert == -1) if (pos2insert == -1)

View File

@ -220,7 +220,7 @@ void DocumentMap::scrollMap()
// Get bottom position of orange marker window // Get bottom position of orange marker window
LRESULT lowerY = 0; LRESULT lowerY = 0;
LRESULT lineHeightMapView = _pMapView->execute(SCI_TEXTHEIGHT, 0); LRESULT lineHeightMapView = _pMapView->execute(SCI_TEXTHEIGHT, 0);
if (not (*_ppEditView)->isWrap()) if (!(*_ppEditView)->isWrap())
{ // not wrapped: mimic height of edit view { // not wrapped: mimic height of edit view
LRESULT lineHeightEditView = (*_ppEditView)->execute(SCI_TEXTHEIGHT, 0); LRESULT lineHeightEditView = (*_ppEditView)->execute(SCI_TEXTHEIGHT, 0);
lowerY = higherY + lineHeightMapView * (rcEditView.bottom - rcEditView.top) / lineHeightEditView; lowerY = higherY + lineHeightMapView * (rcEditView.bottom - rcEditView.top) / lineHeightEditView;
@ -261,7 +261,7 @@ void DocumentMap::scrollMapWith(const MapPosition & mapPos)
// Get the editor's higher/lower Y, then compute the map's higher/lower Y // Get the editor's higher/lower Y, then compute the map's higher/lower Y
LRESULT higherY = 0; LRESULT higherY = 0;
LRESULT lowerY = 0; LRESULT lowerY = 0;
if (not mapPos._isWrap) if (!mapPos._isWrap)
{ {
auto higherPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._firstVisibleDocLine); auto higherPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._firstVisibleDocLine);
auto lowerPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._lastVisibleDocLine); auto lowerPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._lastVisibleDocLine);

View File

@ -425,7 +425,7 @@ void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin
fi._pos = foundPos; fi._pos = foundPos;
} }
if (not classStructName.empty()) if (!classStructName.empty())
{ {
fi._data2 = classStructName; fi._data2 = classStructName;
fi._pos2 = -1; // change -1 valeur for validated data2 fi._pos2 = -1; // change -1 valeur for validated data2
@ -585,7 +585,7 @@ void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair
generic_string classStructName = parseSubLevel(targetStart, targetEnd, _classNameExprArray, foundPos, ppEditView); generic_string classStructName = parseSubLevel(targetStart, targetEnd, _classNameExprArray, foundPos, ppEditView);
if (not _openSymbole.empty() && not _closeSymbole.empty()) if (!_openSymbole.empty() && !_closeSymbole.empty())
{ {
targetEnd = static_cast<int32_t>(getBodyClosePos(targetEnd, _openSymbole.c_str(), _closeSymbole.c_str(), commentZones, ppEditView)); targetEnd = static_cast<int32_t>(getBodyClosePos(targetEnd, _openSymbole.c_str(), _closeSymbole.c_str(), commentZones, ppEditView));
} }

View File

@ -1642,7 +1642,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
wsprintf(buffer, TEXT("%05d-%03d"), LPBGcell->row,LPBGcell->col); wsprintf(buffer, TEXT("%05d-%03d"), LPBGcell->row,LPBGcell->col);
if (not BGHS[SelfIndex].INITIALCONTENT) // performance enhancement while adding new data if (!BGHS[SelfIndex].INITIALCONTENT) // performance enhancement while adding new data
{ {
//see if that cell is already loaded //see if that cell is already loaded
FindResult = BinarySearchListBox(BGHS[SelfIndex].hlist1,buffer); FindResult = BinarySearchListBox(BGHS[SelfIndex].hlist1,buffer);
@ -2988,7 +2988,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//This function needs a static placement position inside a parent window (default in Npp). //This function needs a static placement position inside a parent window (default in Npp).
//For a dynamic position (e.g. sizing of the parenet window) an adjustment to this function is needed! //For a dynamic position (e.g. sizing of the parenet window) an adjustment to this function is needed!
if (not BGHS[SelfIndex].SHOWINTEGRALROWS) if (!BGHS[SelfIndex].SHOWINTEGRALROWS)
break; break;
ShowHscroll(hWnd, SelfIndex); ShowHscroll(hWnd, SelfIndex);

View File

@ -536,7 +536,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case NPPM_INTERNAL_FINDKEYCONFLICTS: case NPPM_INTERNAL_FINDKEYCONFLICTS:
{ {
if (not wParam || not lParam) if (!wParam || !lParam)
break; break;
generic_string conflictInfo; generic_string conflictInfo;
@ -684,7 +684,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
if (not isModified) if (!isModified)
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row); ::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
return TRUE; return TRUE;
@ -842,7 +842,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
break; break;
} }
if (not isModified) if (!isModified)
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row); ::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
return TRUE; return TRUE;
@ -1135,7 +1135,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue; continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1148,7 +1148,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict; return retIsConflict;
else else
{ {
if (not keyConflictLocation->empty()) if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n"); *keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState]; *keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | "); *keyConflictLocation += TEXT(" | ");
@ -1169,7 +1169,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue; continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1182,7 +1182,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict; return retIsConflict;
else else
{ {
if (not keyConflictLocation->empty()) if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n"); *keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState]; *keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | "); *keyConflictLocation += TEXT(" | ");
@ -1203,7 +1203,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue; continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1216,7 +1216,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict; return retIsConflict;
else else
{ {
if (not keyConflictLocation->empty()) if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n"); *keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState]; *keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | "); *keyConflictLocation += TEXT(" | ");
@ -1237,7 +1237,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue; continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1250,7 +1250,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict; return retIsConflict;
else else
{ {
if (not keyConflictLocation->empty()) if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n"); *keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState]; *keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | "); *keyConflictLocation += TEXT(" | ");
@ -1271,7 +1271,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size(); size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex) for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{ {
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue; continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1287,7 +1287,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict; return retIsConflict;
else else
{ {
if (not keyConflictLocation->empty()) if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n"); *keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState]; *keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | "); *keyConflictLocation += TEXT(" | ");

View File

@ -68,7 +68,7 @@ Version::Version(const generic_string& versionStr)
void Version::setVersionFrom(const generic_string& filePath) void Version::setVersionFrom(const generic_string& filePath)
{ {
if (not filePath.empty() && ::PathFileExists(filePath.c_str())) if (!filePath.empty() && ::PathFileExists(filePath.c_str()))
{ {
DWORD handle = 0; DWORD handle = 0;
DWORD bufferSize = ::GetFileVersionInfoSize(filePath.c_str(), &handle); DWORD bufferSize = ::GetFileVersionInfoSize(filePath.c_str(), &handle);
@ -169,20 +169,20 @@ generic_string PluginUpdateInfo::describe()
{ {
generic_string desc; generic_string desc;
const TCHAR *EOL = TEXT("\r\n"); const TCHAR *EOL = TEXT("\r\n");
if (not _description.empty()) if (!_description.empty())
{ {
desc = _description; desc = _description;
desc += EOL; desc += EOL;
} }
if (not _author.empty()) if (!_author.empty())
{ {
desc += TEXT("Author: "); desc += TEXT("Author: ");
desc += _author; desc += _author;
desc += EOL; desc += EOL;
} }
if (not _homepage.empty()) if (!_homepage.empty())
{ {
desc += TEXT("Homepage: "); desc += TEXT("Homepage: ");
desc += _homepage; desc += _homepage;

View File

@ -245,7 +245,7 @@ void PreferenceDlg::makeCategoryList()
int32_t PreferenceDlg::getIndexFromName(const TCHAR *name) const int32_t PreferenceDlg::getIndexFromName(const TCHAR *name) const
{ {
if (not name) if (!name)
return -1; return -1;
int32_t i = 0; int32_t i = 0;
@ -3047,7 +3047,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed // half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not tab.empty() && not warnEnd.empty()) if (!warnBegin.empty() && !space.empty() && !tab.empty() && !warnEnd.empty())
{ {
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr); space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr); tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
@ -3066,7 +3066,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" TAB(s) in your character list."); msg += TEXT(" TAB(s) in your character list.");
} }
} }
else if (nbSp && not nbTab) else if (nbSp && !nbTab)
{ {
generic_string nbSpStr = std::to_wstring(nbSp); generic_string nbSpStr = std::to_wstring(nbSp);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT("")); generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
@ -3074,7 +3074,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed // half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not warnEnd.empty()) if (!warnBegin.empty() && !space.empty() && !warnEnd.empty())
{ {
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr); space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
msg = warnBegin; msg = warnBegin;
@ -3088,7 +3088,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" space(s) in your character list."); msg += TEXT(" space(s) in your character list.");
} }
} }
else if (not nbSp && nbTab) else if (!nbSp && nbTab)
{ {
generic_string nbTabStr = std::to_wstring(nbTab); generic_string nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT("")); generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
@ -3096,7 +3096,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed // half translation is not allowed
if (not warnBegin.empty() && not tab.empty() && not warnEnd.empty()) if (!warnBegin.empty() && !tab.empty() && !warnEnd.empty())
{ {
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr); tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
msg = warnBegin; msg = warnBegin;
@ -3110,7 +3110,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" TAB(s) in your character list."); msg += TEXT(" TAB(s) in your character list.");
} }
} }
else //(not nbSp && not nbTab) else // (!nbSp && !nbTab)
{ {
// do nothing // do nothing
} }
@ -3122,7 +3122,7 @@ void DelimiterSubDlg::setWarningIfNeed() const
{ {
generic_string msg; generic_string msg;
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
if (not nppGUI._isWordCharDefault) if (!nppGUI._isWordCharDefault)
{ {
int nbSp = 0; int nbSp = 0;
int nbTab = 0; int nbTab = 0;
@ -3185,8 +3185,8 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, nppGUI._customWordChars.c_str()); ::SetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, nppGUI._customWordChars.c_str());
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, not nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, !nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault); ::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
setWarningIfNeed(); setWarningIfNeed();
@ -3280,7 +3280,7 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0);
nppGUI._isWordCharDefault = true; nppGUI._isWordCharDefault = true;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault); ::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, TEXT("")); ::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, TEXT(""));
return TRUE; return TRUE;
} }
@ -3290,7 +3290,7 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0);
nppGUI._isWordCharDefault = false; nppGUI._isWordCharDefault = false;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault); ::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
setWarningIfNeed(); setWarningIfNeed();
return TRUE; return TRUE;
} }

View File

@ -529,7 +529,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
} }
setActiveTab(tabIndex); setActiveTab(tabIndex);
} }
else if (not _isMultiLine) // don't scroll if in multi-line mode else if (!_isMultiLine) // don't scroll if in multi-line mode
{ {
RECT rcTabCtrl, rcLastTab; RECT rcTabCtrl, rcLastTab;
::SendMessage(_hSelf, TCM_GETITEMRECT, lastTabIndex, reinterpret_cast<LPARAM>(&rcLastTab)); ::SendMessage(_hSelf, TCM_GETITEMRECT, lastTabIndex, reinterpret_cast<LPARAM>(&rcLastTab));
@ -549,7 +549,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
LONG maxLengthUpDownCtrl = NppParameters::getInstance()._dpiManager.scaleX(44); // sufficient static value LONG maxLengthUpDownCtrl = NppParameters::getInstance()._dpiManager.scaleX(44); // sufficient static value
// scroll forward as long as the last tab is hidden; scroll backward till the first tab // scroll forward as long as the last tab is hidden; scroll backward till the first tab
if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || not isForward) if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || !isForward)
{ {
if (isForward) if (isForward)
++scrollTabIndex; ++scrollTabIndex;

View File

@ -238,22 +238,22 @@ generic_string NativeLangSpeaker::getShortcutNameString(int itemID) const
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const
{ {
if (not _nativeLangA) if (!_nativeLangA)
return defaultString; return defaultString;
if (not strID) if (!strID)
return defaultString; return defaultString;
TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings"); TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings");
if (not node) return defaultString; if (!node) return defaultString;
node = node->FirstChild(strID); node = node->FirstChild(strID);
if (not node) return defaultString; if (!node) return defaultString;
TiXmlElementA *element = node->ToElement(); TiXmlElementA *element = node->ToElement();
const char *value = element->Attribute("value"); const char *value = element->Attribute("value");
if (not value) return defaultString; if (!value) return defaultString;
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
return wmc.char2wchar(value, _nativeLangEncoding); return wmc.char2wchar(value, _nativeLangEncoding);