From b32e9722216ce36e1fb331261e62a4b021fe2004 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 13 Jun 2011 01:24:00 +0000 Subject: [PATCH] [NEW_FEDATURE] Implement VerticalFileSwitcher feature (in progress). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@774 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/nativeLang/finnish.xml | 21 ++- .../installer/nativeLang/serbianCyrillic.xml | 152 ++++++++++-------- PowerEditor/src/Notepad_plus.cpp | 20 ++- PowerEditor/src/Notepad_plus.h | 2 +- PowerEditor/src/NppCommands.cpp | 7 +- PowerEditor/src/NppIO.cpp | 18 ++- PowerEditor/src/NppNotification.cpp | 146 +---------------- PowerEditor/src/ScitillaComponent/Buffer.cpp | 2 +- .../VerticalFileSwitcher.cpp | 11 -- .../VerticalFileSwitcher.h | 17 +- .../VerticalFileSwitcherListView.cpp | 67 +++++++- .../VerticalFileSwitcherListView.h | 8 +- PowerEditor/src/lastRecentFileList.cpp | 2 +- 13 files changed, 227 insertions(+), 246 deletions(-) diff --git a/PowerEditor/installer/nativeLang/finnish.xml b/PowerEditor/installer/nativeLang/finnish.xml index ed327e23e..0d4aedcd7 100644 --- a/PowerEditor/installer/nativeLang/finnish.xml +++ b/PowerEditor/installer/nativeLang/finnish.xml @@ -1,7 +1,7 @@ @@ -34,13 +34,15 @@ Asennusohjeet => https://sourceforge.net/forum/message.php?msg_id=5691520 - + + + @@ -122,6 +124,9 @@ Asennusohjeet => https://sourceforge.net/forum/message.php?msg_id=5691520 + + + @@ -130,7 +135,9 @@ Asennusohjeet => https://sourceforge.net/forum/message.php?msg_id=5691520 - + + + @@ -177,9 +184,9 @@ Asennusohjeet => https://sourceforge.net/forum/message.php?msg_id=5691520 - - - + + + diff --git a/PowerEditor/installer/nativeLang/serbianCyrillic.xml b/PowerEditor/installer/nativeLang/serbianCyrillic.xml index c4f6e801f..d328b80aa 100644 --- a/PowerEditor/installer/nativeLang/serbianCyrillic.xml +++ b/PowerEditor/installer/nativeLang/serbianCyrillic.xml @@ -4,6 +4,7 @@ Last modified Wednesday, Mart 11th 2010 18:06 GMT by Иван Старчевић. Please e-mail errors, suggestions etc. to ivanstar61 at gmail.com. --> + @@ -32,11 +33,14 @@ - - - - - + + + + + + + + @@ -87,7 +91,7 @@ - + @@ -102,6 +106,12 @@ + + + + + + @@ -159,8 +169,11 @@ - + + + + @@ -177,8 +190,9 @@ - - + + + @@ -189,12 +203,12 @@ - - - - - - + + + + + + @@ -215,7 +229,7 @@ - + @@ -225,7 +239,9 @@ - + + + @@ -264,10 +280,10 @@ - + - + @@ -278,10 +294,10 @@ - - + + - + @@ -296,8 +312,8 @@ - - + + @@ -312,7 +328,7 @@ - + @@ -322,19 +338,19 @@ - - + + - + - - - + + + @@ -344,16 +360,18 @@ - - + + + + - - + + @@ -375,8 +393,8 @@ - - + + @@ -386,13 +404,13 @@ - - + + - - + + - + @@ -407,7 +425,7 @@ - + @@ -422,8 +440,8 @@ - - + + @@ -431,13 +449,19 @@ - + - + + + + + + + - + @@ -448,14 +472,14 @@ - + - + @@ -463,13 +487,13 @@ - - + + - + @@ -481,7 +505,7 @@ - + @@ -492,24 +516,24 @@ - + - + - + - + - + @@ -538,9 +562,9 @@ - + - + @@ -552,7 +576,7 @@ - + @@ -567,8 +591,8 @@ - - + + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 4fde2e54d..eba37ec11 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2673,26 +2673,30 @@ void Notepad_plus::loadBufferIntoView(BufferID id, int whichOne, bool dontClose) tabToOpen->setBuffer(0, id); //index 0 since only one open activateBuffer(id, whichOne); //activate. DocTab already activated but not a problem MainFileManager->closeBuffer(idToClose, viewToOpen); //delete the buffer + if (_pFileSwitcherPanel) + _pFileSwitcherPanel->closeItem((int)idToClose); } else { tabToOpen->addBuffer(id); } } -void Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { +bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { DocTabView * tabToClose = (whichOne == MAIN_VIEW)?&_mainDocTab:&_subDocTab; ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW)?&_mainEditView:&_subEditView; //check if buffer exists int index = tabToClose->getIndexByBuffer(id); if (index == -1) //doesn't exist, done - return; + return false; Buffer * buf = MainFileManager->getBufferByID(id); //Cannot close doc if last and clean - if (tabToClose->nbItem() == 1) { - if (!buf->isDirty() && buf->isUntitled()) { - return; //done + if (tabToClose->nbItem() == 1) + { + if (!buf->isDirty() && buf->isUntitled()) + { + return false; } } @@ -2719,6 +2723,7 @@ void Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { } MainFileManager->closeBuffer(id, viewToClose); + return true; } int Notepad_plus::switchEditViewTo(int gid) @@ -4225,6 +4230,11 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) scnN.nmhdr.idFrom = (uptr_t)bufid; _pluginsManager.notify(&scnN); + if (_pFileSwitcherPanel) + { + _pFileSwitcherPanel->activateItem((int)bufid); + } + _linkTriggered = true; } diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 7c2d7e84f..6e89d9e74 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -441,7 +441,7 @@ private: void docOpenInNewInstance(FileTransferMode mode, int x = 0, int y = 0); void loadBufferIntoView(BufferID id, int whichOne, bool dontClose = false); //Doesnt _activate_ the buffer - void removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already + bool removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already bool activateBuffer(BufferID id, int whichOne); //activate buffer in that view if found void notifyBufferActivated(BufferID bufid, int view); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 443c80e10..6505058d2 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -21,7 +21,7 @@ #include "ShortcutMapper.h" #include "TaskListDlg.h" #include "clipboardFormats.h" - +#include "VerticalFileSwitcher.h" void Notepad_plus::macroPlayback(Macro macro) { @@ -847,6 +847,8 @@ void Notepad_plus::command(int id) { Buffer * buf = _pEditView->getCurrentBuffer(); buf->setUserReadOnly(!buf->getUserReadOnly()); + if (_pFileSwitcherPanel) + _pFileSwitcherPanel->setItemIconStatus((int)buf); } break; @@ -858,8 +860,9 @@ void Notepad_plus::command(int id) dwFileAttribs ^= FILE_ATTRIBUTE_READONLY; ::SetFileAttributes(buf->getFullPathName(), dwFileAttribs); - buf->setFileReadOnly(false); + if (_pFileSwitcherPanel) + _pFileSwitcherPanel->setItemIconStatus((int)buf); } break; diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 9d6b3030d..1cb96e76a 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -164,7 +164,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi scnN.nmhdr.code = NPPN_FILEOPENED; _pluginsManager.notify(&scnN); if (_pFileSwitcherPanel) - _pFileSwitcherPanel->newItem((int)buf, fileName); + _pFileSwitcherPanel->newItem((int)buf); } else { @@ -202,7 +202,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi pNppParam->safeWow64EnableWow64FsRedirection(TRUE); isWow64Off = false; } - return buffer;; + return buffer; } bool Notepad_plus::doReload(BufferID id, bool alert) @@ -317,17 +317,20 @@ void Notepad_plus::doClose(BufferID id, int whichOne) { int nrDocs = whichOne==MAIN_VIEW?(_mainDocTab.nbItem()):(_subDocTab.nbItem()); //Do all the works - removeBufferFromView(id, whichOne); + bool isBufRemoved = removeBufferFromView(id, whichOne); if (nrDocs == 1 && canHideView(whichOne)) { //close the view if both visible hideView(whichOne); } // Notify plugins that current file is closed - scnN.nmhdr.code = NPPN_FILECLOSED; - _pluginsManager.notify(&scnN); - if (_pFileSwitcherPanel) - _pFileSwitcherPanel->closeItem((int)id); + if (isBufRemoved) + { + scnN.nmhdr.code = NPPN_FILECLOSED; + _pluginsManager.notify(&scnN); + if (_pFileSwitcherPanel) + _pFileSwitcherPanel->closeItem((int)id); + } return; } @@ -881,6 +884,7 @@ void Notepad_plus::fileOpen() void Notepad_plus::fileNew() { BufferID newBufID = MainFileManager->newEmptyDocument(); + loadBufferIntoView(newBufID, currentView(), true); //true, because we want multiple new files if possible activateBuffer(newBufID, currentView()); } diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index ff5a0eb90..c61fca5a4 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -18,6 +18,7 @@ #include "precompiledHeaders.h" #include "Notepad_plus_Window.h" #include "xmlMatchedTagsHighlighter.h" +#include "VerticalFileSwitcher.h" BOOL Notepad_plus::notify(SCNotification *notification) { @@ -52,142 +53,6 @@ BOOL Notepad_plus::notify(SCNotification *notification) { prevWasEdit = false; } -/* - if (!_isFileOpening && (isFromPrimary || isFromSecondary) && _pEditView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER)) - { - bool isProcessed = false; - - int fromLine = _pEditView->execute(SCI_LINEFROMPOSITION, notification->position); - pair undolevel = _pEditView->getLineUndoState(fromLine); - - if ((notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) && - (notification->modificationType & SC_PERFORMED_USER)) - { - //printStr(TEXT("user type")); - - _pEditView->setLineUndoState(fromLine, undolevel.first+1); - - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - _pEditView->execute(undolevel.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - - - if (notification->linesAdded > 0) - { - for (int i = 0 ; i < notification->linesAdded ; i++) - { - ++fromLine; - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - pair modifInfo = _pEditView->getLineUndoState(fromLine); - _pEditView->execute(modifInfo.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - } - } - } - - if ((notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) && - (notification->modificationType & SC_PERFORMED_REDO) && - (notification->modificationType & SC_MULTISTEPUNDOREDO)) - { - //printStr(TEXT("redo multiple")); - isProcessed = true; - - _pEditView->setLineUndoState(fromLine, undolevel.first+1); - - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - if (notification->linesAdded > 0) - { - for (int i = 0 ; i < notification->linesAdded ; i++) - { - ++fromLine; - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - pair modifInfo = _pEditView->getLineUndoState(fromLine); - _pEditView->execute(modifInfo.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - } - } - } - - if ((notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) && - (notification->modificationType & SC_PERFORMED_UNDO) && - (notification->modificationType & SC_MULTISTEPUNDOREDO)) - { - //printStr(TEXT("undo multiple")); - isProcessed = true; - - --undolevel.first; - if (undolevel.first == 0) - { - _pEditView->execute(SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDUNSAVED); - } - else - { - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - } - _pEditView->execute(undolevel.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - _pEditView->setLineUndoState(fromLine, undolevel.first); - - if (notification->linesAdded > 0) - { - for (int i = fromLine + 1 ; i < fromLine + notification->linesAdded ; i++) - { - pair level = _pEditView->getLineUndoState(i); - if (level.first > 0) - _pEditView->execute(SCI_MARKERADD, i, MARK_LINEMODIFIEDUNSAVED); - _pEditView->execute(level.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - } - } - } - - if ((notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) && - (notification->modificationType & SC_PERFORMED_REDO) && - (notification->modificationType & SC_LASTSTEPINUNDOREDO) && !isProcessed) - { - //printStr(TEXT("redo LASTO")); - _pEditView->setLineUndoState(fromLine, undolevel.first+1); - - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - _pEditView->execute(undolevel.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - - if (notification->linesAdded > 0) - { - for (int i = 0 ; i < notification->linesAdded ; i++) - { - ++fromLine; - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - pair modifInfo = _pEditView->getLineUndoState(fromLine); - _pEditView->execute(modifInfo.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - } - } - } - - if ((notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) && - (notification->modificationType & SC_PERFORMED_UNDO) && - (notification->modificationType & SC_LASTSTEPINUNDOREDO) && !isProcessed) - { - //printStr(TEXT("undo LASTO")); - --undolevel.first; - if (undolevel.first == 0) - { - _pEditView->execute(SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDUNSAVED); - } - else - { - _pEditView->execute(SCI_MARKERADD, fromLine, MARK_LINEMODIFIEDUNSAVED); - } - _pEditView->execute(undolevel.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - _pEditView->setLineUndoState(fromLine, undolevel.first); - - if (notification->linesAdded > 0) - { - for (int i = fromLine + 1 ; i < fromLine + notification->linesAdded ; i++) - { - pair level = _pEditView->getLineUndoState(i); - if (level.first > 0) - _pEditView->execute(SCI_MARKERADD, i, MARK_LINEMODIFIEDUNSAVED); - _pEditView->execute(level.second?SCI_MARKERADD:SCI_MARKERDELETE, fromLine, MARK_LINEMODIFIEDSAVED); - } - } - } - } - */ } break; @@ -215,8 +80,13 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; } } - buf->setDirty(notification->nmhdr.code == SCN_SAVEPOINTLEFT); - break; } + bool isDirty = notification->nmhdr.code == SCN_SAVEPOINTLEFT; + buf->setDirty(isDirty); + if (_pFileSwitcherPanel) + _pFileSwitcherPanel->setItemIconStatus((int)buf); + + break; + } case SCN_MODIFYATTEMPTRO : // on fout rien diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 3080e5df8..1fb06aa01 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -144,7 +144,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang) bool Buffer::checkFileState() { //returns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise struct _stat buf; - if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment + if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment return false; bool isWow64Off = false; diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp index 27c0b9621..8b8b42578 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp @@ -97,17 +97,6 @@ void VerticalFileSwitcher::activateDoc(int i) const int view2set = docPosInfo >> 30; int index2Switch = (docPosInfo << 2) >> 2 ; - //int view2set = _fileListView.getViewInfoFromIndex(i); - //int index2Switch = _fileListView.getDocIndexInfoFromIndex(i); ::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch); } -int VerticalFileSwitcher::newItem(int bufferID, const TCHAR *fn) -{ - return _fileListView.newItem(bufferID, fn); -} - -int VerticalFileSwitcher::closeItem(int bufferID) -{ - return _fileListView.closeItem(bufferID); -} diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h index 901c73d8b..f799daee3 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h @@ -48,8 +48,21 @@ public: //Activate document in scintilla by using the internal index void activateDoc(int i) const; - int newItem(int bufferID, const TCHAR *fn); - int closeItem(int bufferID); + int newItem(int bufferID){ + return _fileListView.newItem(bufferID); + }; + + int closeItem(int bufferID){ + return _fileListView.closeItem(bufferID); + }; + + void activateItem(int bufferID) { + _fileListView.activateItem(bufferID); + }; + + void setItemIconStatus(int bufferID) { + _fileListView.setItemIconStatus(bufferID) ; + }; protected: virtual BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp index 58423ab08..b5b7f98d2 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp @@ -17,6 +17,7 @@ #include "precompiledHeaders.h" #include "VerticalFileSwitcherListView.h" +#include "Buffer.h" void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst) { @@ -108,9 +109,56 @@ int VerticalFileSwitcherListView::getBufferIDFromIndex(int index) const { return int(_taskListInfo._tlfsLst[index]._bufID); } -int VerticalFileSwitcherListView::newItem(int bufferID, const TCHAR *fn) +int VerticalFileSwitcherListView::newItem(int bufferID) +{ + int i = find(bufferID); + if (i == -1) + { + i = add(bufferID); + } + return i; +} +void VerticalFileSwitcherListView::setItemIconStatus(int bufferID) +{ + int i = find(bufferID); + if (i != -1) + { + Buffer *buf = (Buffer *)bufferID; + + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_IMAGE; + item.pszText = (TCHAR *)::PathFindFileName(buf->getFileName()); + item.iItem = i; + item.iSubItem = 0; + item.iImage = buf->getUserReadOnly()||buf->getFileReadOnly()?2:(buf->isDirty()?1:0); + ListView_SetItem(_hSelf, &item); + } +} + +int VerticalFileSwitcherListView::closeItem(int bufferID) +{ + int i = find(bufferID); + if (i != -1) + remove(i); + return i; +} + +void VerticalFileSwitcherListView::activateItem(int bufferID) +{ + int i = find(bufferID); + if (i == -1) + { + newItem(bufferID); + } + ListView_SetItemState(_hSelf, i, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED); +} + +int VerticalFileSwitcherListView::add(int bufferID) { int index = int(_taskListInfo._tlfsLst.size()); + const TCHAR *fn = ((Buffer *)bufferID)->getFileName(); + _taskListInfo._tlfsLst.push_back(TaskLstFnStatus(0, 0, fn, 0, (void *)bufferID)); LVITEM item; @@ -119,18 +167,24 @@ int VerticalFileSwitcherListView::newItem(int bufferID, const TCHAR *fn) item.pszText = (TCHAR *)::PathFindFileName(fn); item.iItem = index; item.iSubItem = 0; - item.iImage = 0; ListView_InsertItem(_hSelf, &item); + ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED); return index; } -int VerticalFileSwitcherListView::closeItem(int bufferID) +void VerticalFileSwitcherListView::remove(int index) { - bool found = false; + _taskListInfo._tlfsLst.erase(_taskListInfo._tlfsLst.begin() + index); + ListView_DeleteItem(_hSelf, index); +} - for (size_t i = 0 ; i < _taskListInfo._tlfsLst.size() ; i++) +int VerticalFileSwitcherListView::find(int bufferID) const +{ + bool found = false; + size_t i = 0; + for (; i < _taskListInfo._tlfsLst.size() ; i++) { if (_taskListInfo._tlfsLst[i]._bufID == (void *)bufferID) { @@ -138,5 +192,6 @@ int VerticalFileSwitcherListView::closeItem(int bufferID) break; } } - return 0; + return (found?i:-1); } + diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h index 588b30a8d..0499c7e12 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h @@ -34,8 +34,10 @@ public: void setBgColour(int i) { ListView_SetItemState(_hSelf, i, LVIS_SELECTED|LVIS_FOCUSED, 0xFF); } - int newItem(int bufferID, const TCHAR *fn); + int newItem(int bufferID); int closeItem(int bufferID); + void activateItem(int bufferID); + void setItemIconStatus(int bufferID); protected: TaskListInfo _taskListInfo; @@ -46,6 +48,10 @@ protected: static LRESULT CALLBACK staticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { return (((VerticalFileSwitcherListView *)(::GetWindowLongPtr(hwnd, GWL_USERDATA)))->runProc(hwnd, Message, wParam, lParam)); }; + + int find(int bufferID) const; + int add(int bufferID); + void remove(int index); }; diff --git a/PowerEditor/src/lastRecentFileList.cpp b/PowerEditor/src/lastRecentFileList.cpp index fc78b1ea0..8616e8934 100644 --- a/PowerEditor/src/lastRecentFileList.cpp +++ b/PowerEditor/src/lastRecentFileList.cpp @@ -69,7 +69,7 @@ void LastRecentFileList::updateMenu() { //Then readd them, so everything stays in sync TCHAR buffer[MAX_PATH]; for(int j = 0; j < _size; j++) { - BuildMenuFileName(buffer, 32, j, _lrfl.at(j)._name.c_str()); + BuildMenuFileName(buffer, 100, j, _lrfl.at(j)._name.c_str()); ::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, buffer); } }