[BUG_FIXED] FIX toolbar bug : make toolbar chevron work.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@515 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-08-03 23:01:20 +00:00
parent 3464682ef6
commit 659a938735
6 changed files with 34 additions and 72 deletions

View File

@ -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 #endif //M30_IDE_COMMUN_H

View File

@ -2749,17 +2749,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
//Else forward notification to window of rebarband //Else forward notification to window of rebarband
REBARBANDINFO rbBand; REBARBANDINFO rbBand;
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); ZeroMemory(&rbBand, REBARBAND_SIZE);
if (winVersion <= WV_W2K) rbBand.cbSize = REBARBAND_SIZE;
{
ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
}
else
{
ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE);
rbBand.cbSize = REBARBANDINFO_V3_SIZE;
}
rbBand.fMask = RBBIM_CHILD; rbBand.fMask = RBBIM_CHILD;
::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, (LPARAM)&rbBand); ::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, (LPARAM)&rbBand);
::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, (LPARAM)lpnm); ::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, (LPARAM)lpnm);
@ -9766,10 +9758,9 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
{ {
checkDocState(); checkDocState();
setTitle(); setTitle();
TCHAR dir[MAX_PATH]; generic_string dir(buffer->getFullPathName());
lstrcpy(dir, buffer->getFullPathName()); PathRemoveFileSpec((TCHAR *)dir.c_str());
PathRemoveFileSpec(dir); setWorkingDir(dir.c_str());
setWorkingDir(dir);
} }
if (mask & (BufferChangeLanguage)) if (mask & (BufferChangeLanguage))
@ -9820,10 +9811,9 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) {
setUniModeText(buf->getUnicodeMode()); setUniModeText(buf->getUnicodeMode());
setDisplayFormat(buf->getFormat()); setDisplayFormat(buf->getFormat());
enableConvertMenuItems(buf->getFormat()); enableConvertMenuItems(buf->getFormat());
TCHAR dir[MAX_PATH]; generic_string dir(buf->getFullPathName());
lstrcpy(dir, buf->getFullPathName()); PathRemoveFileSpec((TCHAR *)dir.c_str());
PathRemoveFileSpec(dir); setWorkingDir(dir.c_str());
setWorkingDir(dir);
setTitle(); setTitle();
//Make sure the colors of the tab controls match //Make sure the colors of the tab controls match
::InvalidateRect(_mainDocTab.getHSelf(), NULL, FALSE); ::InvalidateRect(_mainDocTab.getHSelf(), NULL, FALSE);

View File

@ -741,7 +741,7 @@ private:
void getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir); void getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir);
void doSynScorll(HWND hW); void doSynScorll(HWND hW);
void setWorkingDir(TCHAR *dir) { void setWorkingDir(const TCHAR *dir) {
NppParameters * params = NppParameters::getInstance(); NppParameters * params = NppParameters::getInstance();
if (params->getNppGUI()._openSaveDir == dir_last) if (params->getNppGUI()._openSaveDir == dir_last)
return; return;

View File

@ -413,13 +413,11 @@ bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const
generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
{ {
if (!xmlFullPath[0]) if (!xmlFullPath || !xmlFullPath[0])
return xmlFullPath; return TEXT("");
TCHAR fn[MAX_PATH]; generic_string fn(::PathFindFileName(xmlFullPath));
lstrcpy(fn, ::PathFindFileName(xmlFullPath)); PathRemoveExtension((TCHAR *)fn.c_str());
PathRemoveExtension(fn); return fn.c_str();
generic_string themeName = fn;
return themeName;
} }
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);

View File

@ -2117,17 +2117,8 @@ void FindIncrementDlg::addToRebar(ReBar * rebar)
RECT client; RECT client;
getClientRect(client); getClientRect(client);
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); ZeroMemory(&_rbBand, REBARBAND_SIZE);
if (winVersion <= WV_W2K) _rbBand.cbSize = REBARBAND_SIZE;
{
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 | _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE |
RBBIM_SIZE | RBBIM_ID; RBBIM_SIZE | RBBIM_ID;

View File

@ -255,22 +255,14 @@ void ToolBar::doPopop(POINT chevPoint) {
} }
} }
void ToolBar::addToRebar(ReBar * rebar) { void ToolBar::addToRebar(ReBar * rebar)
{
if (_pRebar) if (_pRebar)
return; return;
_pRebar = rebar; _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 | _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE |
RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_ID; RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_ID;
@ -346,17 +338,9 @@ void ReBar::setIDVisible(int id, bool show)
return; //error return; //error
REBARBANDINFO rbBand; REBARBANDINFO rbBand;
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); ZeroMemory(&rbBand, REBARBAND_SIZE);
if (winVersion <= WV_W2K) rbBand.cbSize = REBARBAND_SIZE;
{
ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
}
else
{
ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE);
rbBand.cbSize = REBARBANDINFO_V3_SIZE;
}
rbBand.fMask = RBBIM_STYLE; rbBand.fMask = RBBIM_STYLE;
::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand);
@ -373,17 +357,9 @@ bool ReBar::getIDVisible(int id)
if (index == -1 ) if (index == -1 )
return false; //error return false; //error
REBARBANDINFO rbBand; REBARBANDINFO rbBand;
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); ZeroMemory(&rbBand, REBARBAND_SIZE);
if (winVersion <= WV_W2K) rbBand.cbSize = REBARBAND_SIZE;
{
ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
}
else
{
ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE);
rbBand.cbSize = REBARBANDINFO_V3_SIZE;
}
rbBand.fMask = RBBIM_STYLE; rbBand.fMask = RBBIM_STYLE;
::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand);
return ((rbBand.fStyle & RBBS_HIDDEN) == 0); return ((rbBand.fStyle & RBBS_HIDDEN) == 0);