From daaaabe744260d9b5de3917dc709591a9db02b78 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 22 Jun 2011 00:12:36 +0000 Subject: [PATCH] [NEW_FEDATURE] Add contextMenu in VerticalFileSwitcher panel. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@779 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppNotification.cpp | 4 ++++ .../VerticalFileSwitcher.cpp | 19 ++++++++++++++++++- .../VerticalFileSwitcherListView.cpp | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 5fcd40e3a..421a5809b 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -282,6 +282,10 @@ BOOL Notepad_plus::notify(SCNotification *notification) { switchEditViewTo(SUB_VIEW); } + else if (_pFileSwitcherPanel && notification->nmhdr.hwndFrom == _pFileSwitcherPanel->getHSelf()) + { + // Already switched, so do nothing here. + } else // From tool bar or Status Bar return TRUE; //break; diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp index 8b8b42578..a3bff4602 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp @@ -26,7 +26,6 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA { case WM_INITDIALOG : { - _fileListView.init(_hInst, _hSelf, _hImaLst); _fileListView.initList(); _fileListView.display(); @@ -50,6 +49,24 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA return TRUE; } + case NM_RCLICK : + { + // Switch to the right document + LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; + int i = lpnmitem->iItem; + if (i == -1) + return TRUE; + activateDoc(i); + + // Redirect NM_RCLICK message to Notepad_plus handle + NMHDR nmhdr; + nmhdr.code = NM_RCLICK; + nmhdr.hwndFrom = _hSelf; + nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom); + ::SendMessage(_hParent, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + return TRUE; + } + case LVN_KEYDOWN: { switch (((LPNMLVKEYDOWN)lParam)->wVKey) diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp index b5b7f98d2..f2b383f3b 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp @@ -102,7 +102,7 @@ void VerticalFileSwitcherListView::initList() ListView_InsertItem(_hSelf, &item); } } -//{} + int VerticalFileSwitcherListView::getBufferIDFromIndex(int index) const { if (index < 0 || index >= int(_taskListInfo._tlfsLst.size())) return -1;