Change to the right name
This commit is contained in:
parent
a98c884470
commit
2befd1321e
@ -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;
|
||||
|
@ -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<HWND> _hModelessDlgs;
|
||||
|
@ -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<ScintillaEditView*>(pTabDocView->getScintillaEditView())));
|
||||
_documentPeeker.doDialog(p, pBuf, *(const_cast<ScintillaEditView*>(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;
|
||||
}
|
||||
|
||||
|
@ -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<HWND>(::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, reinterpret_cast<LPARAM>(_hSelf)));
|
||||
_pSnapshotView = reinterpret_cast<ScintillaEditView *>(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast<LPARAM>(hwndScintilla)));
|
||||
_pSnapshotView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0);
|
||||
_pSnapshotView->execute(SCI_SETVSCROLLBAR, FALSE, 0);
|
||||
_pSnapshotView->execute(SCI_SETHSCROLLBAR, FALSE, 0);
|
||||
_pPeekerView = reinterpret_cast<ScintillaEditView *>(::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, reinterpret_cast<LPARAM>(hwndScintilla)));
|
||||
_pPeekerView->execute(SCI_SETZOOM, static_cast<WPARAM>(-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<LPARAM>(buf->getDocument()));
|
||||
_pSnapshotView->setCurrentBuffer(buf);
|
||||
_pPeekerView->execute(SCI_SETDOCPOINTER, 0, static_cast<LPARAM>(buf->getDocument()));
|
||||
_pPeekerView->setCurrentBuffer(buf);
|
||||
|
||||
//
|
||||
// folding
|
||||
//
|
||||
const std::vector<size_t> & 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<int32_t>(editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine));
|
||||
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);
|
||||
|
||||
// Width
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user