[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
This commit is contained in:
Don Ho 2012-02-26 01:59:51 +00:00
parent f89bd5aeea
commit 9d1e836079
3 changed files with 59 additions and 55 deletions

View File

@ -592,6 +592,9 @@ public:
}; };
void setHiLiteResultWords(const TCHAR *keywords); void setHiLiteResultWords(const TCHAR *keywords);
void defineDocType(LangType typeDoc); //setup stylers for active document void defineDocType(LangType typeDoc); //setup stylers for active document
void mouseWheel(WPARAM wParam, LPARAM lParam) {
scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam);
};
/* /*
pair<size_t, bool> getLineUndoState(size_t currentLine) { pair<size_t, bool> getLineUndoState(size_t currentLine) {

View File

@ -33,6 +33,7 @@ void DocumentMap::reloadMap()
// sync with the current document // sync with the current document
// Lexing // Lexing
_pScintillaEditView->defineDocType((*_ppEditView)->getCurrentBuffer()->getLangType()); _pScintillaEditView->defineDocType((*_ppEditView)->getCurrentBuffer()->getLangType());
_pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false);
// folding // folding
_pScintillaEditView->syncFoldStateWith((*_ppEditView)->getCurrentFoldStates()); _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.init(::GetModuleHandle(NULL), _hSelf);
_vzDlg.doDialog(); _vzDlg.doDialog();
(NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 100); // 0 <= transparancy < 256 (NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256
return TRUE; return TRUE;
} }
case WM_DESTROY: case WM_DESTROY:
@ -302,7 +303,7 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
} }
scrollMap(); scrollMap();
/* /*
int newHigher = newPosY - (currentHeight / 2); int newHigher = newPosY - (currentHeight / 2);
int newLower = newPosY + (currentHeight / 2); int newLower = newPosY + (currentHeight / 2);
@ -313,11 +314,18 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
} }
*/ */
} }
return TRUE; return TRUE;
case DOCUMENTMAP_MOUSEWHEEL:
{
//::SendMessage((*_ppEditView)->getHSelf(), WM_MOUSEWHEEL, wParam, lParam);
(*_ppEditView)->mouseWheel(wParam, lParam);
}
return TRUE;
default : default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam); 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) void ViewZoneDlg::drawPreviewZone(DRAWITEMSTRUCT *pdis)
{ {
//switch (pdis->itemAction) RECT rc = pdis->rcItem;
{
//case ODA_DRAWENTIRE:
//switch (pdis->CtlID)
{
//case IDC_GLASS:
{
RECT rc = pdis->rcItem;
//const COLORREF red = RGB(0xFF, 0x00, 0x00); //const COLORREF red = RGB(0xFF, 0x00, 0x00);
//const COLORREF yellow = RGB(0xFF, 0xFF, 0); //const COLORREF yellow = RGB(0xFF, 0xFF, 0);
//const COLORREF grey = RGB(128, 128, 128); //const COLORREF grey = RGB(128, 128, 128);
const COLORREF orange = RGB(0xFF, 0x80, 0x00); const COLORREF orange = RGB(0xFF, 0x80, 0x00);
//const COLORREF liteGrey = RGB(192, 192, 192); //const COLORREF liteGrey = RGB(192, 192, 192);
const COLORREF white = RGB(0xFF, 0xFF, 0xFF); const COLORREF white = RGB(0xFF, 0xFF, 0xFF);
HBRUSH hbrushFg = CreateSolidBrush(orange); HBRUSH hbrushFg = CreateSolidBrush(orange);
HBRUSH hbrushBg = CreateSolidBrush(white); HBRUSH hbrushBg = CreateSolidBrush(white);
FillRect(pdis->hDC, &rc, hbrushBg); FillRect(pdis->hDC, &rc, hbrushBg);
rc.top = _higherY; rc.top = _higherY;
rc.bottom = _lowerY; rc.bottom = _lowerY;
FillRect(pdis->hDC, &rc, hbrushFg); FillRect(pdis->hDC, &rc, hbrushFg);
/* /*
HPEN hpen = CreatePen(PS_SOLID, 1, RGB(0x00, 0x00, 0x00)); HPEN hpen = CreatePen(PS_SOLID, 1, RGB(0x00, 0x00, 0x00));
HPEN holdPen = (HPEN)SelectObject(pdis->hDC, hpen); HPEN holdPen = (HPEN)SelectObject(pdis->hDC, hpen);
::MoveToEx(pdis->hDC, 0 , _higherY , NULL); ::MoveToEx(pdis->hDC, 0 , _higherY , NULL);
::LineTo(pdis->hDC, rc.left, _higherY); ::LineTo(pdis->hDC, rc.left, _higherY);
::MoveToEx(pdis->hDC, 0 , _lowerY , NULL); ::MoveToEx(pdis->hDC, 0 , _lowerY , NULL);
::LineTo(pdis->hDC, rc.left, _lowerY); ::LineTo(pdis->hDC, rc.left, _lowerY);
SelectObject(pdis->hDC, holdPen); SelectObject(pdis->hDC, holdPen);
DeleteObject(hpen); DeleteObject(hpen);
*/ */
DeleteObject(hbrushFg);
DeleteObject(hbrushBg);
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;
*/
}
} }
void ViewZoneDlg::doDialog() void ViewZoneDlg::doDialog()
@ -444,6 +429,21 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
return TRUE; 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 : case WM_DESTROY :
{ {
return TRUE; return TRUE;
@ -466,7 +466,7 @@ BOOL CALLBACK ViewZoneDlg::canvas_runProc(HWND hwnd, UINT message, WPARAM wParam
{ {
case WM_DESTROY: case WM_DESTROY:
{ {
::MessageBoxA(NULL,"Destroy","",MB_OK); //::MessageBoxA(NULL,"Destroy","",MB_OK);
} }
return TRUE; return TRUE;

View File

@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define DOCUMENTMAP_SCROLL (WM_USER + 1) #define DOCUMENTMAP_SCROLL (WM_USER + 1)
#define DOCUMENTMAP_MOUSECLICKED (WM_USER + 2) #define DOCUMENTMAP_MOUSECLICKED (WM_USER + 2)
#define DOCUMENTMAP_MOUSEWHEEL (WM_USER + 3)
class ScintillaEditView; class ScintillaEditView;
const bool moveDown = true; const bool moveDown = true;