From 9d1e83607902e146144125aa6744a94def6f47ab Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 26 Feb 2012 01:59:51 +0000 Subject: [PATCH] [NEW_FEATURE] Doc map: mouse wheel is working. [BUG_FIXED] Doc map: Remove the unnecessary merge. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@871 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/ScitillaComponent/ScintillaEditView.h | 3 + .../WinControls/DocumentMap/documentMap.cpp | 110 +++++++++--------- .../src/WinControls/DocumentMap/documentMap.h | 1 + 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 291e60a8..60a23899 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -592,6 +592,9 @@ public: }; void setHiLiteResultWords(const TCHAR *keywords); void defineDocType(LangType typeDoc); //setup stylers for active document + void mouseWheel(WPARAM wParam, LPARAM lParam) { + scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam); + }; /* pair getLineUndoState(size_t currentLine) { diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 112962f0..402dcda9 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -33,6 +33,7 @@ void DocumentMap::reloadMap() // sync with the current document // Lexing _pScintillaEditView->defineDocType((*_ppEditView)->getCurrentBuffer()->getLangType()); + _pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); // folding _pScintillaEditView->syncFoldStateWith((*_ppEditView)->getCurrentFoldStates()); @@ -150,7 +151,7 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara _vzDlg.init(::GetModuleHandle(NULL), _hSelf); _vzDlg.doDialog(); - (NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 100); // 0 <= transparancy < 256 + (NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256 return TRUE; } case WM_DESTROY: @@ -302,7 +303,7 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara } scrollMap(); - /* +/* int newHigher = newPosY - (currentHeight / 2); int newLower = newPosY + (currentHeight / 2); @@ -312,12 +313,19 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara newLower = currentHeight; } */ - - } return TRUE; + case DOCUMENTMAP_MOUSEWHEEL: + { + //::SendMessage((*_ppEditView)->getHSelf(), WM_MOUSEWHEEL, wParam, lParam); + (*_ppEditView)->mouseWheel(wParam, lParam); + } + return TRUE; + + + default : return DockingDlgInterface::run_dlgProc(message, wParam, lParam); } @@ -326,58 +334,35 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara void ViewZoneDlg::drawPreviewZone(DRAWITEMSTRUCT *pdis) { - //switch (pdis->itemAction) - { - //case ODA_DRAWENTIRE: - //switch (pdis->CtlID) - { - //case IDC_GLASS: - { - 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); - FillRect(pdis->hDC, &rc, hbrushBg); + 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); + FillRect(pdis->hDC, &rc, hbrushBg); - rc.top = _higherY; - rc.bottom = _lowerY; - FillRect(pdis->hDC, &rc, hbrushFg); - /* - HPEN hpen = CreatePen(PS_SOLID, 1, RGB(0x00, 0x00, 0x00)); - HPEN holdPen = (HPEN)SelectObject(pdis->hDC, hpen); - - ::MoveToEx(pdis->hDC, 0 , _higherY , NULL); - ::LineTo(pdis->hDC, rc.left, _higherY); - ::MoveToEx(pdis->hDC, 0 , _lowerY , NULL); - ::LineTo(pdis->hDC, rc.left, _lowerY); + rc.top = _higherY; + rc.bottom = _lowerY; + FillRect(pdis->hDC, &rc, hbrushFg); + /* + HPEN hpen = CreatePen(PS_SOLID, 1, RGB(0x00, 0x00, 0x00)); + HPEN holdPen = (HPEN)SelectObject(pdis->hDC, hpen); + + ::MoveToEx(pdis->hDC, 0 , _higherY , NULL); + ::LineTo(pdis->hDC, rc.left, _higherY); + ::MoveToEx(pdis->hDC, 0 , _lowerY , NULL); + ::LineTo(pdis->hDC, rc.left, _lowerY); - SelectObject(pdis->hDC, holdPen); - DeleteObject(hpen); - */ - - - DeleteObject(hbrushFg); - DeleteObject(hbrushBg); - //FrameRect(pdis->hDC, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH)); - //break; - } - } - // *** FALL THROUGH *** - /* - case ODA_SELECT: - break; - case ODA_FOCUS: - break; - default: - break; - */ - } + SelectObject(pdis->hDC, holdPen); + DeleteObject(hpen); + */ + DeleteObject(hbrushFg); + DeleteObject(hbrushBg); } void ViewZoneDlg::doDialog() @@ -444,6 +429,21 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara 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); + } + return TRUE; + case WM_DESTROY : { return TRUE; @@ -466,7 +466,7 @@ BOOL CALLBACK ViewZoneDlg::canvas_runProc(HWND hwnd, UINT message, WPARAM wParam { case WM_DESTROY: { - ::MessageBoxA(NULL,"Destroy","",MB_OK); + //::MessageBoxA(NULL,"Destroy","",MB_OK); } return TRUE; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 73a7b1b9..784ff756 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define DOCUMENTMAP_SCROLL (WM_USER + 1) #define DOCUMENTMAP_MOUSECLICKED (WM_USER + 2) +#define DOCUMENTMAP_MOUSEWHEEL (WM_USER + 3) class ScintillaEditView; const bool moveDown = true;