diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index a65cbf243..623325b80 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -132,4 +132,11 @@ private: }; +#if _MSC_VER > 1400 // MS Compiler > VS 2005 +#define REBARBAND_SIZE REBARBANDINFO_V3_SIZE +#else +#define REBARBAND_SIZE sizeof(REBARBANDINFO) +#endif + + #endif //M30_IDE_COMMUN_H diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8780cc81c..75feb4134 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2749,17 +2749,9 @@ BOOL Notepad_plus::notify(SCNotification *notification) } //Else forward notification to window of rebarband REBARBANDINFO rbBand; - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion <= WV_W2K) - { - ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); - rbBand.cbSize = sizeof(REBARBANDINFO); - } - else - { - ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); - rbBand.cbSize = REBARBANDINFO_V3_SIZE; - } + ZeroMemory(&rbBand, REBARBAND_SIZE); + rbBand.cbSize = REBARBAND_SIZE; + rbBand.fMask = RBBIM_CHILD; ::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, (LPARAM)&rbBand); ::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, (LPARAM)lpnm); @@ -9766,10 +9758,9 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) { { checkDocState(); setTitle(); - TCHAR dir[MAX_PATH]; - lstrcpy(dir, buffer->getFullPathName()); - PathRemoveFileSpec(dir); - setWorkingDir(dir); + generic_string dir(buffer->getFullPathName()); + PathRemoveFileSpec((TCHAR *)dir.c_str()); + setWorkingDir(dir.c_str()); } if (mask & (BufferChangeLanguage)) @@ -9820,10 +9811,9 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) { setUniModeText(buf->getUnicodeMode()); setDisplayFormat(buf->getFormat()); enableConvertMenuItems(buf->getFormat()); - TCHAR dir[MAX_PATH]; - lstrcpy(dir, buf->getFullPathName()); - PathRemoveFileSpec(dir); - setWorkingDir(dir); + generic_string dir(buf->getFullPathName()); + PathRemoveFileSpec((TCHAR *)dir.c_str()); + setWorkingDir(dir.c_str()); setTitle(); //Make sure the colors of the tab controls match ::InvalidateRect(_mainDocTab.getHSelf(), NULL, FALSE); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index f2f61c1b6..5f9c3181f 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -741,7 +741,7 @@ private: void getMatchedFileNames(const TCHAR *dir, const vector & patterns, vector & fileNames, bool isRecursive, bool isInHiddenDir); void doSynScorll(HWND hW); - void setWorkingDir(TCHAR *dir) { + void setWorkingDir(const TCHAR *dir) { NppParameters * params = NppParameters::getInstance(); if (params->getNppGUI()._openSaveDir == dir_last) return; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 0c8c89b81..ca3b80fcc 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -413,13 +413,11 @@ bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const { - if (!xmlFullPath[0]) - return xmlFullPath; - TCHAR fn[MAX_PATH]; - lstrcpy(fn, ::PathFindFileName(xmlFullPath)); - PathRemoveExtension(fn); - generic_string themeName = fn; - return themeName; + if (!xmlFullPath || !xmlFullPath[0]) + return TEXT(""); + generic_string fn(::PathFindFileName(xmlFullPath)); + PathRemoveExtension((TCHAR *)fn.c_str()); + return fn.c_str(); } typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 684407a27..2bccbd61d 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -2117,17 +2117,8 @@ void FindIncrementDlg::addToRebar(ReBar * rebar) RECT client; getClientRect(client); - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion <= WV_W2K) - { - ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); - _rbBand.cbSize = sizeof(REBARBANDINFO); - } - else - { - ZeroMemory(&_rbBand, REBARBANDINFO_V3_SIZE); - _rbBand.cbSize = REBARBANDINFO_V3_SIZE; - } + ZeroMemory(&_rbBand, REBARBAND_SIZE); + _rbBand.cbSize = REBARBAND_SIZE; _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_ID; diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index f928927a9..1904ad489 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -255,22 +255,14 @@ void ToolBar::doPopop(POINT chevPoint) { } } -void ToolBar::addToRebar(ReBar * rebar) { +void ToolBar::addToRebar(ReBar * rebar) +{ if (_pRebar) return; _pRebar = rebar; + ZeroMemory(&_rbBand, REBARBAND_SIZE); + _rbBand.cbSize = REBARBAND_SIZE; - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion <= WV_W2K) - { - ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); - _rbBand.cbSize = sizeof(REBARBANDINFO); - } - else - { - ZeroMemory(&_rbBand, REBARBANDINFO_V3_SIZE); - _rbBand.cbSize = REBARBANDINFO_V3_SIZE; - } _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_ID; @@ -346,17 +338,9 @@ void ReBar::setIDVisible(int id, bool show) return; //error REBARBANDINFO rbBand; - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion <= WV_W2K) - { - ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); - rbBand.cbSize = sizeof(REBARBANDINFO); - } - else - { - ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); - rbBand.cbSize = REBARBANDINFO_V3_SIZE; - } + ZeroMemory(&rbBand, REBARBAND_SIZE); + rbBand.cbSize = REBARBAND_SIZE; + rbBand.fMask = RBBIM_STYLE; ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); @@ -373,17 +357,9 @@ bool ReBar::getIDVisible(int id) if (index == -1 ) return false; //error REBARBANDINFO rbBand; - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion <= WV_W2K) - { - ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); - rbBand.cbSize = sizeof(REBARBANDINFO); - } - else - { - ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); - rbBand.cbSize = REBARBANDINFO_V3_SIZE; - } + ZeroMemory(&rbBand, REBARBAND_SIZE); + rbBand.cbSize = REBARBAND_SIZE; + rbBand.fMask = RBBIM_STYLE; ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); return ((rbBand.fStyle & RBBS_HIDDEN) == 0);