From 1309f8fa8e74848488ffabfeaf0e600e85331116 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 22 May 2011 00:11:19 +0000 Subject: [PATCH] [UPDATE] Implement file switcher feature (in progress). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@760 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppCommands.cpp | 2 +- .../VerticalFileSwitcher.cpp | 18 +++++++++++++++--- .../VerticalFileSwitcherListView.cpp | 12 ++++++++++++ .../VerticalFileSwitcherListView.h | 2 ++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index a7bc41007..d1b834cbe 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -45,13 +45,13 @@ void Notepad_plus::command(int id) case IDM_FILE_NEW: { fileNew(); - //launchFileSwitcherPanel(); } break; case IDM_FILE_OPEN: { fileOpen(); + //launchFileSwitcherPanel(); } break; diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp index bdfbc9343..3799b9ca2 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp @@ -33,13 +33,25 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA return TRUE; } -/* + case WM_NOTIFY: { switch (((LPNMHDR)lParam)->code) { - case NM_DBLCLK: + case NM_CLICK: { + LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; + int i = lpnmitem->iItem; + + if (i == -1) + return TRUE; +//printInt(i); +//printStr(TEXT("OK")); + + int view2set = _fileListView.getViewInfoFromIndex(i); + int index2Switch = _fileListView.getDocIndexInfoFromIndex(i); + ::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch); + return TRUE; } default: @@ -47,7 +59,7 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA } } return TRUE; -*/ + case WM_SIZE: { int width = LOWORD(lParam); diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp index dd07eac42..7c0c564d6 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp @@ -99,3 +99,15 @@ void VerticalFileSwitcherListView::initList() ListView_InsertItem(_hSelf, &item); } } +//{} +int VerticalFileSwitcherListView::getViewInfoFromIndex(int index) const { + if (index < 0 || index >= int(_taskListInfo._tlfsLst.size())) + return -1; + return _taskListInfo._tlfsLst[index]._iView; +} + +int VerticalFileSwitcherListView::getDocIndexInfoFromIndex(int index) const { + if (index < 0 || index >= int(_taskListInfo._tlfsLst.size())) + return -1; + return _taskListInfo._tlfsLst[index]._docIndex; +} \ No newline at end of file diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h index 0bcd95b45..5651c7ebd 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h @@ -30,6 +30,8 @@ public: virtual void init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst); virtual void destroy(); void initList(); + int getViewInfoFromIndex(int index) const; + int getDocIndexInfoFromIndex(int index) const; protected: TaskListInfo _taskListInfo;