[ENHANCEMENT] Enhance doc map.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@883 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-03-15 01:28:31 +00:00
parent 671e7b1b4d
commit 989a970dd2
4 changed files with 17 additions and 65 deletions

View File

@ -4793,19 +4793,8 @@ void Notepad_plus::launchDocMap()
// in this case is DOCKABLE_DEMO_INDEX
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_DOC_MAP;
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data);
//_pDocMap->setMainEditorWrap(_pEditView->isWrap());
}
else
{
/*
// Disable wrap text
if (!_pDocMap->isVisible())
{
_pDocMap->setMainEditorWrap(_pEditView->isWrap());
}
*/
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data);
}
_pDocMap->initWrapMap();

View File

@ -421,7 +421,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
if (_pDocMap)
{
//_pDocMap->doMove();
_pDocMap->doMove();
_pDocMap->reloadMap();
}

View File

@ -1,6 +1,6 @@
/*
this file is part of notepad++
Copyright (C)2011 Don HO <donho@altern.org>
Copyright (C)2012 Don HO <donho@altern.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -196,14 +196,13 @@ void DocumentMap::doMove()
{
RECT rc;
POINT pt = {0,0};
::ClientToScreen(_pScintillaEditView->getHSelf(), &pt);
::ClientToScreen(_hSelf, &pt);
getClientRect(rc);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, (rc.right - rc.left), (rc.bottom - rc.top), TRUE);
}
void DocumentMap::fold(int line, bool foldOrNot)
{
//bool isExpanded = _pScintillaEditView->execute(SCI_GETFOLDEXPANDED, line) != 0;
_pScintillaEditView->fold(line, foldOrNot);
}
@ -237,7 +236,6 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
{
case WM_INITDIALOG :
{
//_glassHandle = ::GetDlgItem(_hSelf, IDC_GLASS);
HWND hwndScintilla = (HWND)::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, (LPARAM)_hSelf);
_pScintillaEditView = (ScintillaEditView *)::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, (LPARAM)hwndScintilla);
::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETZOOM, (WPARAM)-10, 0);
@ -276,8 +274,11 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
if (_vzDlg.isCreated())
{
POINT pt = {0,0};
::ClientToScreen(_pScintillaEditView->getHSelf(), &pt);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width-4, height-4, TRUE);
::ClientToScreen(_hSelf, &pt);
if (!_pScintillaEditView->isWrap())
::MoveWindow(_pScintillaEditView->getHSelf(), 0, 0, width, height, TRUE);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width, height, TRUE);
}
}
break;
@ -313,10 +314,14 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
int width = rc.right - rc.left;
int height = rc.bottom - rc.top;
POINT pt = {0,0};
::ClientToScreen(_pScintillaEditView->getHSelf(), &pt);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width-4, height-4, TRUE);
//RECT scinrc;
//_pScintillaEditView->getClientRect(scinrc);
//int scinrcWidth = scinrc.right - scinrc.left;
//::MoveWindow(_pScintillaEditView->getHSelf(), 0, 0, scinrcWidth, height, TRUE);
POINT pt = {0,0};
::ClientToScreen(_hSelf, &pt);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width, height, TRUE);
scrollMap();
return TRUE;
}
@ -380,7 +385,6 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
case DOCUMENTMAP_MOUSEWHEEL:
{
//::SendMessage((*_ppEditView)->getHSelf(), WM_MOUSEWHEEL, wParam, lParam);
(*_ppEditView)->mouseWheel(wParam, lParam);
}
return TRUE;
@ -397,11 +401,7 @@ void ViewZoneDlg::drawPreviewZone(DRAWITEMSTRUCT *pdis)
{
RECT rc = pdis->rcItem;
//const COLORREF red = RGB(0xFF, 0x00, 0x00);
//const COLORREF yellow = RGB(0xFF, 0xFF, 0);
//const COLORREF grey = RGB(128, 128, 128);
const COLORREF orange = RGB(0xFF, 0x80, 0x00);
//const COLORREF liteGrey = RGB(192, 192, 192);
const COLORREF white = RGB(0xFF, 0xFF, 0xFF);
HBRUSH hbrushFg = CreateSolidBrush(orange);
HBRUSH hbrushBg = CreateSolidBrush(white);
@ -463,32 +463,9 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
}
break;
}
case WM_COMMAND :
{/*
switch (wParam)
{
case IDCANCEL :
case IDOK :
display(false);
return TRUE;
default :
break;
}
*/
return TRUE;
}
case WM_MOUSEWHEEL :
{
/*
if (LOWORD(wParam) & MK_RBUTTON)
{
::SendMessage(_hParent, Message, wParam, lParam);
return TRUE;
}
*/
//Have to perform the scroll first, because the first/last line do not get updated untill after the scroll has been parsed
::SendMessage(_hParent, DOCUMENTMAP_MOUSEWHEEL, wParam, lParam);
}

View File

@ -1,6 +1,6 @@
/*
this file is part of notepad++
Copyright (C)2003 Don HO ( donho@altern.org )
Copyright (C)2012 Don HO <donho@altern.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -99,8 +99,6 @@ public:
_hParent = parent2set;
};
//void wrapScintilla(bool doWrap);
void reloadMap();
void wrapMap();
void initWrapMap();
@ -108,14 +106,6 @@ public:
void scrollMap(bool direction, moveMode whichMode);
void doMove();
void fold(int line, bool foldOrNot);
/*
void setMainEditorWrap(bool isWrap) {
_isMainEditorWrap = isWrap;
};
bool isMainEditorWrap() const {
return _isMainEditorWrap;
};
*/
protected:
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
@ -125,15 +115,11 @@ protected:
private:
ScintillaEditView **_ppEditView;
ScintillaEditView *_pScintillaEditView;
//HWND _glassHandle;
ViewZoneDlg _vzDlg;
//bool _isMainEditorWrap;
//bool _wrapUnwrapTriggered;
// for needToRecomputeWith function
int _displayZoom;
int _displayWidth;
//int _displayHeight;
};