Change to the right name

This commit is contained in:
Don HO 2017-05-15 09:22:31 +02:00
parent a98c884470
commit 2befd1321e
5 changed files with 45 additions and 45 deletions

View File

@ -634,7 +634,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_md5FromFilesDlg.init(_pPublicInterface->getHinst(), hwnd); _md5FromFilesDlg.init(_pPublicInterface->getHinst(), hwnd);
_md5FromTextDlg.init(_pPublicInterface->getHinst(), hwnd); _md5FromTextDlg.init(_pPublicInterface->getHinst(), hwnd);
_runMacroDlg.init(_pPublicInterface->getHinst(), hwnd); _runMacroDlg.init(_pPublicInterface->getHinst(), hwnd);
_documentSnapshot.init(_pPublicInterface->getHinst(), hwnd); _documentPeeker.init(_pPublicInterface->getHinst(), hwnd);
//--User Define Dialog Section--// //--User Define Dialog Section--//
int uddStatus = nppGUI._userDefineDlgStatus; int uddStatus = nppGUI._userDefineDlgStatus;

View File

@ -283,7 +283,7 @@ private:
PreferenceDlg _preference; PreferenceDlg _preference;
FindCharsInRangeDlg _findCharsInRangeDlg; FindCharsInRangeDlg _findCharsInRangeDlg;
PluginsAdminDlg _pluginsAdminDlg; PluginsAdminDlg _pluginsAdminDlg;
DocumentSnapshot _documentSnapshot; DocumentPeeker _documentPeeker;
// a handle list of all the Notepad++ dialogs // a handle list of all the Notepad++ dialogs
std::vector<HWND> _hModelessDlgs; std::vector<HWND> _hModelessDlgs;

View File

@ -176,11 +176,11 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (pBuf != currentBufMain && pBuf != currentBufSub) // if hover on other tab if (pBuf != currentBufMain && pBuf != currentBufSub) // if hover on other tab
{ {
_documentSnapshot.doDialog(p, pBuf, *(const_cast<ScintillaEditView*>(pTabDocView->getScintillaEditView()))); _documentPeeker.doDialog(p, pBuf, *(const_cast<ScintillaEditView*>(pTabDocView->getScintillaEditView())));
} }
else // if hover on current active tab else // if hover on current active tab
{ {
_documentSnapshot.display(false); _documentPeeker.display(false);
} }
} }
} }
@ -222,7 +222,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (doPeekOnTab) if (doPeekOnTab)
{ {
_documentSnapshot.display(false); _documentPeeker.display(false);
} }
if (doPeekOnMap && _pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible()) if (doPeekOnMap && _pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible())
@ -358,7 +358,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
break; break;
// save map position before switch to a new document // save map position before switch to a new document
_documentSnapshot.saveCurrentSnapshot(*_pEditView); _documentPeeker.saveCurrentSnapshot(*_pEditView);
switchEditViewTo(iView); switchEditViewTo(iView);
BufferID bufid = _pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()); BufferID bufid = _pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex());
@ -368,7 +368,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
activateBuffer(bufid, iView); activateBuffer(bufid, iView);
_isFolding = false; _isFolding = false;
} }
_documentSnapshot.display(false); _documentPeeker.display(false);
break; break;
} }

View File

@ -29,29 +29,29 @@
#include "documentSnapshot.h" #include "documentSnapshot.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
INT_PTR CALLBACK DocumentSnapshot::run_dlgProc(UINT message, WPARAM /*wParam*/, LPARAM /*lParam*/) INT_PTR CALLBACK DocumentPeeker::run_dlgProc(UINT message, WPARAM /*wParam*/, LPARAM /*lParam*/)
{ {
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
HWND hwndScintilla = reinterpret_cast<HWND>(::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, reinterpret_cast<LPARAM>(_hSelf))); HWND hwndScintilla = reinterpret_cast<HWND>(::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, reinterpret_cast<LPARAM>(_hSelf)));
_pSnapshotView = reinterpret_cast<ScintillaEditView *>(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast<LPARAM>(hwndScintilla))); _pPeekerView = reinterpret_cast<ScintillaEditView *>(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast<LPARAM>(hwndScintilla)));
_pSnapshotView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0); _pPeekerView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0);
_pSnapshotView->execute(SCI_SETVSCROLLBAR, FALSE, 0); _pPeekerView->execute(SCI_SETVSCROLLBAR, FALSE, 0);
_pSnapshotView->execute(SCI_SETHSCROLLBAR, FALSE, 0); _pPeekerView->execute(SCI_SETHSCROLLBAR, FALSE, 0);
_pSnapshotView->showIndentGuideLine(false); _pPeekerView->showIndentGuideLine(false);
::MoveWindow(_pSnapshotView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE); ::MoveWindow(_pPeekerView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE);
_pSnapshotView->display(); _pPeekerView->display();
} }
break; break;
} }
return FALSE; return FALSE;
} }
void DocumentSnapshot::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scintSource) void DocumentPeeker::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scintSource)
{ {
if (!isCreated()) if (!isCreated())
{ {
@ -59,27 +59,27 @@ void DocumentSnapshot::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scint
} }
syncDisplay(pBuf, scintSource); syncDisplay(pBuf, scintSource);
// Adjust the position of DocumentSnapshot // Adjust the position of DocumentPeeker
goTo(p); goTo(p);
} }
void DocumentSnapshot::goTo(POINT p) void DocumentPeeker::goTo(POINT p)
{ {
::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y + 10, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW); ::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y + 10, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW);
} }
void DocumentSnapshot::syncDisplay(Buffer *buf, ScintillaEditView & scintSource) void DocumentPeeker::syncDisplay(Buffer *buf, ScintillaEditView & scintSource)
{ {
if (_pSnapshotView) if (_pPeekerView)
{ {
_pSnapshotView->execute(SCI_SETDOCPOINTER, 0, static_cast<LPARAM>(buf->getDocument())); _pPeekerView->execute(SCI_SETDOCPOINTER, 0, static_cast<LPARAM>(buf->getDocument()));
_pSnapshotView->setCurrentBuffer(buf); _pPeekerView->setCurrentBuffer(buf);
// //
// folding // folding
// //
const std::vector<size_t> & lineStateVector = buf->getHeaderLineState(&scintSource); const std::vector<size_t> & lineStateVector = buf->getHeaderLineState(&scintSource);
_pSnapshotView->syncFoldStateWith(lineStateVector); _pPeekerView->syncFoldStateWith(lineStateVector);
// //
// Wraping & scrolling // Wraping & scrolling
@ -88,25 +88,25 @@ void DocumentSnapshot::syncDisplay(Buffer *buf, ScintillaEditView & scintSource)
if (mp.isValid()) if (mp.isValid())
scrollSnapshotWith(mp); scrollSnapshotWith(mp);
Buffer *buf = _pSnapshotView->getCurrentBuffer(); Buffer *buf = _pPeekerView->getCurrentBuffer();
_pSnapshotView->defineDocType(buf->getLangType()); _pPeekerView->defineDocType(buf->getLangType());
_pSnapshotView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); _pPeekerView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false);
_pSnapshotView->showMargin(0, false); _pPeekerView->showMargin(0, false);
_pSnapshotView->showMargin(1, false); _pPeekerView->showMargin(1, false);
_pSnapshotView->showMargin(2, false); _pPeekerView->showMargin(2, false);
_pSnapshotView->showMargin(3, false); _pPeekerView->showMargin(3, false);
_pSnapshotView->execute(SCI_SETREADONLY, true); _pPeekerView->execute(SCI_SETREADONLY, true);
_pSnapshotView->execute(SCI_SETCARETSTYLE, CARETSTYLE_INVISIBLE); _pPeekerView->execute(SCI_SETCARETSTYLE, CARETSTYLE_INVISIBLE);
Window::display(); Window::display();
} }
} }
void DocumentSnapshot::scrollSnapshotWith(const MapPosition & mapPos) void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos)
{ {
if (_pSnapshotView) if (_pPeekerView)
{ {
bool hasBeenChanged = false; bool hasBeenChanged = false;
// //
@ -123,31 +123,31 @@ void DocumentSnapshot::scrollSnapshotWith(const MapPosition & mapPos)
hasBeenChanged = true; hasBeenChanged = true;
} }
if (hasBeenChanged) if (hasBeenChanged)
::MoveWindow(_pSnapshotView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE); ::MoveWindow(_pPeekerView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE);
// //
// Wrapping // Wrapping
// //
_pSnapshotView->wrap(mapPos._isWrap); _pPeekerView->wrap(mapPos._isWrap);
_pSnapshotView->execute(SCI_SETWRAPINDENTMODE, mapPos._wrapIndentMode); _pPeekerView->execute(SCI_SETWRAPINDENTMODE, mapPos._wrapIndentMode);
// //
// Reset to zero // Reset to zero
// //
_pSnapshotView->execute(SCI_HOMEDISPLAY); _pPeekerView->execute(SCI_HOMEDISPLAY);
// //
// Visible line for the code view // Visible line for the code view
// //
// scroll to the first visible display line // scroll to the first visible display line
_pSnapshotView->execute(SCI_LINESCROLL, 0,mapPos._firstVisibleDisplayLine); _pPeekerView->execute(SCI_LINESCROLL, 0,mapPos._firstVisibleDisplayLine);
} }
} }
void DocumentSnapshot::saveCurrentSnapshot(ScintillaEditView & editView) void DocumentPeeker::saveCurrentSnapshot(ScintillaEditView & editView)
{ {
if (_pSnapshotView) if (_pPeekerView)
{ {
Buffer *buffer = editView.getCurrentBuffer(); Buffer *buffer = editView.getCurrentBuffer();
MapPosition mapPos = buffer->getMapPosition(); MapPosition mapPos = buffer->getMapPosition();
@ -158,7 +158,7 @@ void DocumentSnapshot::saveCurrentSnapshot(ScintillaEditView & editView)
mapPos._nbLine = static_cast<int32_t>(editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine)); mapPos._nbLine = static_cast<int32_t>(editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine));
mapPos._lastVisibleDocLine = static_cast<int32_t>(editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine + mapPos._nbLine)); mapPos._lastVisibleDocLine = static_cast<int32_t>(editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine + mapPos._nbLine));
auto lineHeight = _pSnapshotView->execute(SCI_TEXTHEIGHT, mapPos._firstVisibleDocLine); auto lineHeight = _pPeekerView->execute(SCI_TEXTHEIGHT, mapPos._firstVisibleDocLine);
mapPos._height = static_cast<int32_t>(mapPos._nbLine * lineHeight); mapPos._height = static_cast<int32_t>(mapPos._nbLine * lineHeight);
// Width // Width

View File

@ -36,9 +36,9 @@ class Buffer;
struct MapPosition; struct MapPosition;
class DocumentSnapshot : public StaticDialog { class DocumentPeeker : public StaticDialog {
public: public:
DocumentSnapshot(): StaticDialog() {}; DocumentPeeker(): StaticDialog() {};
void init(HINSTANCE hInst, HWND hPere) { void init(HINSTANCE hInst, HWND hPere) {
Window::init(hInst, hPere); Window::init(hInst, hPere);
@ -61,5 +61,5 @@ protected:
void goTo(POINT p); void goTo(POINT p);
private: private:
ScintillaEditView *_pSnapshotView = nullptr; ScintillaEditView *_pPeekerView = nullptr;
}; };