Fix a minor bug in "Show content in doc map on mous hover"

Fix a compiling error for x64 build
This commit is contained in:
Don HO 2017-03-14 09:09:01 +01:00
parent fe463dc03a
commit 6a3d9e994d
3 changed files with 33 additions and 18 deletions

View File

@ -151,7 +151,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case TCN_MOUSEHOVERING:
case TCN_MOUSEHOVERSWITCHING:
{
/*
///*
if (_pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible())
{
TBHDR *tbHdr = reinterpret_cast<TBHDR *>(notification);
@ -159,20 +159,30 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (pTabDocView)
{
BufferID id = pTabDocView->getBufferByIndex(tbHdr->tabOrigin);
Buffer * pBuf = MainFileManager->getBufferByID(id);
Buffer *pBuf = MainFileManager->getBufferByID(id);
Buffer *currentBuf = getCurrentBuffer();
if (pBuf != currentBuf) // if hover on other tab
{
_pDocMap->showInMapTemporarily(pBuf, notifyView);
_pDocMap->setSyntaxHiliting();
}
else // if hover on current active tab
{
_pDocMap->reloadMap();
_pDocMap->setSyntaxHiliting();
}
_pDocMap->setTemporarilyShowing(true);
}
}
*/
//*/
break;
}
case TCN_MOUSELEAVING:
{
/*
///*
if (_pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible())
{
_pDocMap->reloadMap();
@ -180,7 +190,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_pDocMap->setTemporarilyShowing(false);
}
*/
//*/
break;
}

View File

@ -2003,10 +2003,19 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p
(childNode->ToElement())->Attribute(TEXT("scrollWidth"), &position._scrollWidth);
MapPosition mapPosition;
(childNode->ToElement())->Attribute(TEXT("mapFirstVisibleDocLine"), &mapPosition._firstVisibleDocLine);
(childNode->ToElement())->Attribute(TEXT("mapLastVisibleDocLine"), &mapPosition._lastVisibleDocLine);
(childNode->ToElement())->Attribute(TEXT("mapNbLine"), &mapPosition._nbLine);
(childNode->ToElement())->Attribute(TEXT("mapHigherPos"), &mapPosition._higherPos);
int32_t mapPosVal;
const TCHAR *mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapFirstVisibleDocLine"), &mapPosVal);
if (mapPosStr)
mapPosition._firstVisibleDocLine = mapPosVal;
mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapLastVisibleDocLine"), &mapPosVal);
if (mapPosStr)
mapPosition._lastVisibleDocLine = mapPosVal;
mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapNbLine"), &mapPosVal);
if (mapPosStr)
mapPosition._nbLine = mapPosVal;
mapPosStr = (childNode->ToElement())->Attribute(TEXT("mapHigherPos"), &mapPosVal);
if (mapPosStr)
mapPosition._higherPos = mapPosVal;
const TCHAR *langName;
langName = (childNode->ToElement())->Attribute(TEXT("lang"));

View File

@ -236,7 +236,7 @@ void DocumentMap::scrollMap(ScintillaEditView *editView)
// Get the editor's higher/lower Y, then compute the map's higher/lower Y
LRESULT higherY = 0;
LRESULT lowerY = 0;
auto higherPos = -1 ; // -1 => not pEditView->isWrap()
LRESULT higherPos = -1 ; // -1 => not pEditView->isWrap()
if (not pEditView->isWrap())
{
auto higherPos = _pScintillaEditView->execute(SCI_POSITIONFROMLINE, firstVisibleDocLine);
@ -252,14 +252,14 @@ void DocumentMap::scrollMap(ScintillaEditView *editView)
else
{
higherPos = pEditView->execute(SCI_POSITIONFROMPOINT, 0, 0);
higherY = _pScintillaEditView->execute(SCI_POINTYFROMPOSITION, 0, higherPos);
higherY = _pScintillaEditView->execute(SCI_POINTYFROMPOSITION, 0, static_cast<int32_t>(higherPos));
auto lineHeight = _pScintillaEditView->execute(SCI_TEXTHEIGHT, firstVisibleDocLine);
lowerY = nbLine * lineHeight + higherY;
}
// set current map position in buffer
Buffer *buffer = pEditView->getCurrentBuffer();
buffer->setMapPosition(firstVisibleDocLine, lastVisibleDocLine, nbLine, higherPos);
buffer->setMapPosition(static_cast<int32_t>(firstVisibleDocLine), static_cast<int32_t>(lastVisibleDocLine), static_cast<int32_t>(nbLine), static_cast<int32_t>(higherPos));
// Update view zone in map
_vzDlg.drawZone(static_cast<long>(higherY), static_cast<long>(lowerY));
@ -445,9 +445,7 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
default:
break;
}
}
return TRUE;
@ -478,8 +476,6 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
}
return TRUE;
default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}