[UPDATE] Implement file switcher feature (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@760 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-05-22 00:11:19 +00:00
parent 1e441838a4
commit 1309f8fa8e
4 changed files with 30 additions and 4 deletions

View File

@ -45,13 +45,13 @@ void Notepad_plus::command(int id)
case IDM_FILE_NEW: case IDM_FILE_NEW:
{ {
fileNew(); fileNew();
//launchFileSwitcherPanel();
} }
break; break;
case IDM_FILE_OPEN: case IDM_FILE_OPEN:
{ {
fileOpen(); fileOpen();
//launchFileSwitcherPanel();
} }
break; break;

View File

@ -33,13 +33,25 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
return TRUE; return TRUE;
} }
/*
case WM_NOTIFY: case WM_NOTIFY:
{ {
switch (((LPNMHDR)lParam)->code) 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; return TRUE;
} }
default: default:
@ -47,7 +59,7 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
} }
} }
return TRUE; return TRUE;
*/
case WM_SIZE: case WM_SIZE:
{ {
int width = LOWORD(lParam); int width = LOWORD(lParam);

View File

@ -99,3 +99,15 @@ void VerticalFileSwitcherListView::initList()
ListView_InsertItem(_hSelf, &item); 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;
}

View File

@ -30,6 +30,8 @@ public:
virtual void init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst); virtual void init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst);
virtual void destroy(); virtual void destroy();
void initList(); void initList();
int getViewInfoFromIndex(int index) const;
int getDocIndexInfoFromIndex(int index) const;
protected: protected:
TaskListInfo _taskListInfo; TaskListInfo _taskListInfo;