From 2befd1321e658483160827d020193b6cc6205965 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 15 May 2017 09:22:31 +0200 Subject: [PATCH] Change to the right name --- PowerEditor/src/Notepad_plus.cpp | 2 +- PowerEditor/src/Notepad_plus.h | 2 +- PowerEditor/src/NppNotification.cpp | 10 +-- .../DocumentMap/documentSnapshot.cpp | 70 +++++++++---------- .../DocumentMap/documentSnapshot.h | 6 +- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 78f747cbe..38f669e90 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -634,7 +634,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _md5FromFilesDlg.init(_pPublicInterface->getHinst(), hwnd); _md5FromTextDlg.init(_pPublicInterface->getHinst(), hwnd); _runMacroDlg.init(_pPublicInterface->getHinst(), hwnd); - _documentSnapshot.init(_pPublicInterface->getHinst(), hwnd); + _documentPeeker.init(_pPublicInterface->getHinst(), hwnd); //--User Define Dialog Section--// int uddStatus = nppGUI._userDefineDlgStatus; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index d857a8a63..ada0c751c 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -283,7 +283,7 @@ private: PreferenceDlg _preference; FindCharsInRangeDlg _findCharsInRangeDlg; PluginsAdminDlg _pluginsAdminDlg; - DocumentSnapshot _documentSnapshot; + DocumentPeeker _documentPeeker; // a handle list of all the Notepad++ dialogs std::vector _hModelessDlgs; diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 5d2cf3ee8..d2c21bd9f 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -176,11 +176,11 @@ BOOL Notepad_plus::notify(SCNotification *notification) if (pBuf != currentBufMain && pBuf != currentBufSub) // if hover on other tab { - _documentSnapshot.doDialog(p, pBuf, *(const_cast(pTabDocView->getScintillaEditView()))); + _documentPeeker.doDialog(p, pBuf, *(const_cast(pTabDocView->getScintillaEditView()))); } 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) { - _documentSnapshot.display(false); + _documentPeeker.display(false); } if (doPeekOnMap && _pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible()) @@ -358,7 +358,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; // save map position before switch to a new document - _documentSnapshot.saveCurrentSnapshot(*_pEditView); + _documentPeeker.saveCurrentSnapshot(*_pEditView); switchEditViewTo(iView); BufferID bufid = _pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()); @@ -368,7 +368,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) activateBuffer(bufid, iView); _isFolding = false; } - _documentSnapshot.display(false); + _documentPeeker.display(false); break; } diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp index c563470d6..a071d8958 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp @@ -29,29 +29,29 @@ #include "documentSnapshot.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) { case WM_INITDIALOG : { HWND hwndScintilla = reinterpret_cast(::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, reinterpret_cast(_hSelf))); - _pSnapshotView = reinterpret_cast(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast(hwndScintilla))); - _pSnapshotView->execute(SCI_SETZOOM, static_cast(-10), 0); - _pSnapshotView->execute(SCI_SETVSCROLLBAR, FALSE, 0); - _pSnapshotView->execute(SCI_SETHSCROLLBAR, FALSE, 0); + _pPeekerView = reinterpret_cast(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast(hwndScintilla))); + _pPeekerView->execute(SCI_SETZOOM, static_cast(-10), 0); + _pPeekerView->execute(SCI_SETVSCROLLBAR, 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); - _pSnapshotView->display(); + ::MoveWindow(_pPeekerView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE); + _pPeekerView->display(); } break; } return FALSE; } -void DocumentSnapshot::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scintSource) +void DocumentPeeker::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scintSource) { if (!isCreated()) { @@ -59,27 +59,27 @@ void DocumentSnapshot::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scint } syncDisplay(pBuf, scintSource); - // Adjust the position of DocumentSnapshot + // Adjust the position of DocumentPeeker 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); } -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(buf->getDocument())); - _pSnapshotView->setCurrentBuffer(buf); + _pPeekerView->execute(SCI_SETDOCPOINTER, 0, static_cast(buf->getDocument())); + _pPeekerView->setCurrentBuffer(buf); // // folding // const std::vector & lineStateVector = buf->getHeaderLineState(&scintSource); - _pSnapshotView->syncFoldStateWith(lineStateVector); + _pPeekerView->syncFoldStateWith(lineStateVector); // // Wraping & scrolling @@ -88,25 +88,25 @@ void DocumentSnapshot::syncDisplay(Buffer *buf, ScintillaEditView & scintSource) if (mp.isValid()) scrollSnapshotWith(mp); - Buffer *buf = _pSnapshotView->getCurrentBuffer(); - _pSnapshotView->defineDocType(buf->getLangType()); - _pSnapshotView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); + Buffer *buf = _pPeekerView->getCurrentBuffer(); + _pPeekerView->defineDocType(buf->getLangType()); + _pPeekerView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); - _pSnapshotView->showMargin(0, false); - _pSnapshotView->showMargin(1, false); - _pSnapshotView->showMargin(2, false); - _pSnapshotView->showMargin(3, false); + _pPeekerView->showMargin(0, false); + _pPeekerView->showMargin(1, false); + _pPeekerView->showMargin(2, false); + _pPeekerView->showMargin(3, false); - _pSnapshotView->execute(SCI_SETREADONLY, true); - _pSnapshotView->execute(SCI_SETCARETSTYLE, CARETSTYLE_INVISIBLE); + _pPeekerView->execute(SCI_SETREADONLY, true); + _pPeekerView->execute(SCI_SETCARETSTYLE, CARETSTYLE_INVISIBLE); Window::display(); } } -void DocumentSnapshot::scrollSnapshotWith(const MapPosition & mapPos) +void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos) { - if (_pSnapshotView) + if (_pPeekerView) { bool hasBeenChanged = false; // @@ -123,31 +123,31 @@ void DocumentSnapshot::scrollSnapshotWith(const MapPosition & mapPos) hasBeenChanged = true; } 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 // - _pSnapshotView->wrap(mapPos._isWrap); - _pSnapshotView->execute(SCI_SETWRAPINDENTMODE, mapPos._wrapIndentMode); + _pPeekerView->wrap(mapPos._isWrap); + _pPeekerView->execute(SCI_SETWRAPINDENTMODE, mapPos._wrapIndentMode); // // Reset to zero // - _pSnapshotView->execute(SCI_HOMEDISPLAY); + _pPeekerView->execute(SCI_HOMEDISPLAY); // // Visible line for the code view // // 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(); MapPosition mapPos = buffer->getMapPosition(); @@ -158,7 +158,7 @@ void DocumentSnapshot::saveCurrentSnapshot(ScintillaEditView & editView) mapPos._nbLine = static_cast(editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine)); mapPos._lastVisibleDocLine = static_cast(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(mapPos._nbLine * lineHeight); // Width diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h index ebd25d0b4..0851d50ed 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h @@ -36,9 +36,9 @@ class Buffer; struct MapPosition; -class DocumentSnapshot : public StaticDialog { +class DocumentPeeker : public StaticDialog { public: - DocumentSnapshot(): StaticDialog() {}; + DocumentPeeker(): StaticDialog() {}; void init(HINSTANCE hInst, HWND hPere) { Window::init(hInst, hPere); @@ -61,5 +61,5 @@ protected: void goTo(POINT p); private: - ScintillaEditView *_pSnapshotView = nullptr; + ScintillaEditView *_pPeekerView = nullptr; };