mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-04 04:24:38 +02:00
parent
36d13f3ad8
commit
36d0d29cc7
@ -1279,6 +1279,7 @@ Continue?"/>
|
|||||||
<PanelTitle name="Document List"/>
|
<PanelTitle name="Document List"/>
|
||||||
<ColumnName name="Name"/>
|
<ColumnName name="Name"/>
|
||||||
<ColumnExt name="Ext."/>
|
<ColumnExt name="Ext."/>
|
||||||
|
<ColumnPath name="Path"/>
|
||||||
</DocList>
|
</DocList>
|
||||||
<WindowsDlg>
|
<WindowsDlg>
|
||||||
<ColumnName name="Name"/>
|
<ColumnName name="Name"/>
|
||||||
|
@ -383,10 +383,14 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 };
|
|||||||
// INT NPPM_GETCURRENTVIEW(0, 0)
|
// INT NPPM_GETCURRENTVIEW(0, 0)
|
||||||
// Return: current edit view of Notepad++. Only 2 possible values: 0 = Main, 1 = Secondary
|
// Return: current edit view of Notepad++. Only 2 possible values: 0 = Main, 1 = Secondary
|
||||||
|
|
||||||
#define NPPM_DOCLISTDISABLECOLUMN (NPPMSG + 89)
|
#define NPPM_DOCLISTDISABLEEXTCOLUMN (NPPMSG + 89)
|
||||||
// VOID NPPM_DOCLISTDISABLECOLUMN(0, BOOL disableOrNot)
|
// VOID NPPM_DOCLISTDISABLEEXTCOLUMN(0, BOOL disableOrNot)
|
||||||
// Disable or enable extension column of Document List
|
// Disable or enable extension column of Document List
|
||||||
|
|
||||||
|
#define NPPM_DOCLISTDISABLEPATHCOLUMN (NPPMSG + 102)
|
||||||
|
// VOID NPPM_DOCLISTDISABLEPATHCOLUMN(0, BOOL disableOrNot)
|
||||||
|
// Disable or enable path column of Document List
|
||||||
|
|
||||||
#define NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR (NPPMSG + 90)
|
#define NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR (NPPMSG + 90)
|
||||||
// INT NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR(0, 0)
|
// INT NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR(0, 0)
|
||||||
// Return: current editor default foreground color. You should convert the returned value in COLORREF
|
// Return: current editor default foreground color. You should convert the returned value in COLORREF
|
||||||
|
@ -2451,11 +2451,16 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
return langDesc.length();
|
return langDesc.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_DOCLISTDISABLECOLUMN:
|
case NPPM_DOCLISTDISABLEPATHCOLUMN:
|
||||||
|
case NPPM_DOCLISTDISABLEEXTCOLUMN:
|
||||||
{
|
{
|
||||||
BOOL isOff = static_cast<BOOL>(lParam);
|
BOOL isOff = static_cast<BOOL>(lParam);
|
||||||
NppGUI & nppGUI = nppParam.getNppGUI();
|
NppGUI & nppGUI = nppParam.getNppGUI();
|
||||||
nppGUI._fileSwitcherWithoutExtColumn = isOff == TRUE;
|
|
||||||
|
if (message == NPPM_DOCLISTDISABLEEXTCOLUMN)
|
||||||
|
nppGUI._fileSwitcherWithoutExtColumn = isOff == TRUE;
|
||||||
|
else
|
||||||
|
nppGUI._fileSwitcherWithoutPathColumn = isOff == TRUE;
|
||||||
|
|
||||||
if (_pDocumentListPanel)
|
if (_pDocumentListPanel)
|
||||||
{
|
{
|
||||||
|
@ -5365,6 +5365,17 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||||||
if (optName)
|
if (optName)
|
||||||
_nppGUI._fileSwitcherWithoutExtColumn = (lstrcmp(optName, TEXT("yes")) == 0);
|
_nppGUI._fileSwitcherWithoutExtColumn = (lstrcmp(optName, TEXT("yes")) == 0);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
if (element->Attribute(TEXT("fileSwitcherExtWidth"), &i))
|
||||||
|
_nppGUI._fileSwitcherExtWidth = i;
|
||||||
|
|
||||||
|
const TCHAR * optNamePath = element->Attribute(TEXT("fileSwitcherWithoutPathColumn"));
|
||||||
|
if (optNamePath)
|
||||||
|
_nppGUI._fileSwitcherWithoutPathColumn = (lstrcmp(optNamePath, TEXT("yes")) == 0);
|
||||||
|
|
||||||
|
if (element->Attribute(TEXT("fileSwitcherPathWidth"), &i))
|
||||||
|
_nppGUI._fileSwitcherPathWidth = i;
|
||||||
|
|
||||||
const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql"));
|
const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql"));
|
||||||
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
|
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
|
||||||
_nppGUI._backSlashIsEscapeCharacterForSql = false;
|
_nppGUI._backSlashIsEscapeCharacterForSql = false;
|
||||||
@ -6428,6 +6439,9 @@ void NppParameters::createXmlTreeFromGUIParams()
|
|||||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC"));
|
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC"));
|
||||||
|
|
||||||
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no"));
|
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no"));
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("fileSwitcherExtWidth"), _nppGUI._fileSwitcherExtWidth);
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutPathColumn"), _nppGUI._fileSwitcherWithoutPathColumn ? TEXT("yes") : TEXT("no"));
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("fileSwitcherPathWidth"), _nppGUI._fileSwitcherPathWidth);
|
||||||
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no"));
|
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no"));
|
||||||
GUIConfigElement->SetAttribute(TEXT("writeTechnologyEngine"), _nppGUI._writeTechnologyEngine);
|
GUIConfigElement->SetAttribute(TEXT("writeTechnologyEngine"), _nppGUI._writeTechnologyEngine);
|
||||||
GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no"));
|
GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no"));
|
||||||
|
@ -832,7 +832,10 @@ struct NppGUI final
|
|||||||
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
|
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
|
||||||
generic_string _themeName;
|
generic_string _themeName;
|
||||||
MultiInstSetting _multiInstSetting = monoInst;
|
MultiInstSetting _multiInstSetting = monoInst;
|
||||||
bool _fileSwitcherWithoutExtColumn = false;
|
bool _fileSwitcherWithoutExtColumn = true;
|
||||||
|
int _fileSwitcherExtWidth = 50;
|
||||||
|
bool _fileSwitcherWithoutPathColumn = true;
|
||||||
|
int _fileSwitcherPathWidth = 50;
|
||||||
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
|
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
|
||||||
bool _isSnapshotMode = true;
|
bool _isSnapshotMode = true;
|
||||||
size_t _snapshotBackupTiming = 7000;
|
size_t _snapshotBackupTiming = 7000;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define GET_Y_LPARAM(lp) static_cast<short>(HIWORD(lp))
|
#define GET_Y_LPARAM(lp) static_cast<short>(HIWORD(lp))
|
||||||
|
|
||||||
#define CLMNEXT_ID 1
|
#define CLMNEXT_ID 1
|
||||||
|
#define CLMNPATH_ID 2
|
||||||
|
|
||||||
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
{
|
{
|
||||||
@ -195,6 +196,29 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
case HDN_DIVIDERDBLCLICK:
|
||||||
|
case HDN_ENDTRACK:
|
||||||
|
{
|
||||||
|
NppParameters& nppParams = NppParameters::getInstance();
|
||||||
|
NativeLangSpeaker* pNativeSpeaker = nppParams.getNativeLangSpeaker();
|
||||||
|
|
||||||
|
LPNMHEADER test = (LPNMHEADER)lParam;
|
||||||
|
HWND hwndHD = ListView_GetHeader(_fileListView.getHSelf());
|
||||||
|
TCHAR HDtext[MAX_PATH];
|
||||||
|
HDITEM hdi = { 0 };
|
||||||
|
hdi.mask = HDI_TEXT | HDI_WIDTH;
|
||||||
|
hdi.pszText = HDtext;
|
||||||
|
hdi.cchTextMax = MAX_PATH;
|
||||||
|
Header_GetItem(hwndHD, test->iItem, &hdi);
|
||||||
|
|
||||||
|
// storing column width data
|
||||||
|
if (hdi.pszText == pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT))
|
||||||
|
nppParams.getNppGUI()._fileSwitcherExtWidth = hdi.cxy;
|
||||||
|
else if (hdi.pszText == pNativeSpeaker->getAttrNameStr(TEXT("Path"), FS_ROOTNODE, FS_CLMNPATH))
|
||||||
|
nppParams.getNppGUI()._fileSwitcherPathWidth = hdi.cxy;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
case LVN_KEYDOWN:
|
case LVN_KEYDOWN:
|
||||||
{
|
{
|
||||||
switch (((LPNMLVKEYDOWN)lParam)->wVKey)
|
switch (((LPNMLVKEYDOWN)lParam)->wVKey)
|
||||||
@ -227,7 +251,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
int width = LOWORD(lParam);
|
int width = LOWORD(lParam);
|
||||||
int height = HIWORD(lParam);
|
int height = HIWORD(lParam);
|
||||||
::MoveWindow(_fileListView.getHSelf(), 0, 0, width, height, TRUE);
|
::MoveWindow(_fileListView.getHSelf(), 0, 0, width, height, TRUE);
|
||||||
_fileListView.resizeColumns(width);
|
_fileListView.resizeColumns(width);
|
||||||
@ -266,14 +290,19 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
void VerticalFileSwitcher::initPopupMenus()
|
void VerticalFileSwitcher::initPopupMenus()
|
||||||
{
|
{
|
||||||
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||||
|
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
|
||||||
|
|
||||||
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
|
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
|
||||||
|
generic_string pathStr = pNativeSpeaker->getAttrNameStr(TEXT("Path"), FS_ROOTNODE, FS_CLMNPATH);
|
||||||
|
|
||||||
_hGlobalMenu = ::CreatePopupMenu();
|
_hGlobalMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, CLMNEXT_ID, extStr.c_str());
|
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, CLMNEXT_ID, extStr.c_str());
|
||||||
|
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, CLMNPATH_ID, pathStr.c_str());
|
||||||
|
|
||||||
bool isExtColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = nppGUI._fileSwitcherWithoutExtColumn;
|
||||||
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | isExtColumn ? MF_UNCHECKED : MF_CHECKED);
|
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | isExtColumn ? MF_UNCHECKED : MF_CHECKED);
|
||||||
|
bool isPathColumn = nppGUI._fileSwitcherWithoutPathColumn;
|
||||||
|
::CheckMenuItem(_hGlobalMenu, CLMNPATH_ID, MF_BYCOMMAND | isPathColumn ? MF_UNCHECKED : MF_CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalFileSwitcher::popupMenuCmd(int cmdID)
|
void VerticalFileSwitcher::popupMenuCmd(int cmdID)
|
||||||
@ -288,6 +317,14 @@ void VerticalFileSwitcher::popupMenuCmd(int cmdID)
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CLMNPATH_ID:
|
||||||
|
{
|
||||||
|
bool& isPathColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutPathColumn;
|
||||||
|
isPathColumn = !isPathColumn;
|
||||||
|
::CheckMenuItem(_hGlobalMenu, CLMNPATH_ID, MF_BYCOMMAND | isPathColumn ? MF_UNCHECKED : MF_CHECKED);
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,50 +115,33 @@ LRESULT VerticalFileSwitcherListView::runProc(HWND hwnd, UINT Message, WPARAM wP
|
|||||||
|
|
||||||
void VerticalFileSwitcherListView::initList()
|
void VerticalFileSwitcherListView::initList()
|
||||||
{
|
{
|
||||||
HWND colHeader = reinterpret_cast<HWND>(SendMessage(_hSelf, LVM_GETHEADER, 0, 0));
|
|
||||||
int columnCount = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0));
|
|
||||||
|
|
||||||
NppParameters& nppParams = NppParameters::getInstance();
|
NppParameters& nppParams = NppParameters::getInstance();
|
||||||
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
|
||||||
|
|
||||||
bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
|
bool isPathColumn = !nppParams.getNppGUI()._fileSwitcherWithoutPathColumn;
|
||||||
|
|
||||||
// check if columns need to be added
|
RECT rc;
|
||||||
if (columnCount <= 1)
|
::GetClientRect(_hParent, &rc);
|
||||||
|
int nameWidth = rc.right - rc.left;
|
||||||
|
int colIndex = 0;
|
||||||
|
if (isExtColumn)
|
||||||
|
nameWidth -= nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherExtWidth);
|
||||||
|
if (isPathColumn)
|
||||||
|
nameWidth -= nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth);
|
||||||
|
|
||||||
|
//add columns
|
||||||
|
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
|
||||||
|
insertColumn(nameStr.c_str(), nameWidth, ++colIndex);
|
||||||
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
RECT rc;
|
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
|
||||||
::GetClientRect(_hParent, &rc);
|
insertColumn(extStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherExtWidth), ++colIndex); //2nd column
|
||||||
int totalWidth = rc.right - rc.left;
|
|
||||||
const int extColWidth =80;
|
|
||||||
|
|
||||||
if (columnCount == 0)
|
|
||||||
{
|
|
||||||
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
|
|
||||||
insertColumn(nameStr.c_str(), (isExtColumn ? totalWidth - extColWidth : totalWidth), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isExtColumn)
|
|
||||||
{
|
|
||||||
// resize "Name" column when "exts" won't fit
|
|
||||||
LVCOLUMN lvc;
|
|
||||||
lvc.mask = LVCF_WIDTH;
|
|
||||||
SendMessage(_hSelf, LVM_GETCOLUMN, 0, reinterpret_cast<LPARAM>(&lvc));
|
|
||||||
|
|
||||||
if (lvc.cx + extColWidth > totalWidth)
|
|
||||||
{
|
|
||||||
lvc.cx = totalWidth - extColWidth;
|
|
||||||
SendMessage(_hSelf, LVM_SETCOLUMN, 0, reinterpret_cast<LPARAM>(&lvc));
|
|
||||||
}
|
|
||||||
|
|
||||||
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
|
|
||||||
insertColumn(extStr.c_str(), extColWidth, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (isPathColumn)
|
||||||
// "exts" was disabled
|
|
||||||
if (columnCount >= 2 && !isExtColumn)
|
|
||||||
{
|
{
|
||||||
ListView_DeleteColumn(_hSelf, 1);
|
generic_string pathStr = pNativeSpeaker->getAttrNameStr(TEXT("Path"), FS_ROOTNODE, FS_CLMNPATH);
|
||||||
|
insertColumn(pathStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth), ++colIndex); //2nd column if .ext is off
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskListInfo taskListInfo;
|
TaskListInfo taskListInfo;
|
||||||
@ -187,9 +170,17 @@ void VerticalFileSwitcherListView::initList()
|
|||||||
item.iImage = fileNameStatus._status;
|
item.iImage = fileNameStatus._status;
|
||||||
item.lParam = reinterpret_cast<LPARAM>(tl);
|
item.lParam = reinterpret_cast<LPARAM>(tl);
|
||||||
ListView_InsertItem(_hSelf, &item);
|
ListView_InsertItem(_hSelf, &item);
|
||||||
|
int colIndex = 0;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
ListView_SetItemText(_hSelf, i, 1, ::PathFindExtension(fileNameStatus._fn.c_str()));
|
ListView_SetItemText(_hSelf, i, ++colIndex, ::PathFindExtension(fileNameStatus._fn.c_str()));
|
||||||
|
}
|
||||||
|
if (isPathColumn)
|
||||||
|
{
|
||||||
|
TCHAR dir[MAX_PATH], drive[MAX_PATH];
|
||||||
|
_wsplitpath_s(fileNameStatus._fn.c_str(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
|
||||||
|
wcscat_s(drive, dir);
|
||||||
|
ListView_SetItemText(_hSelf, i, ++colIndex, drive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView_SetItemState(_hSelf, taskListInfo._currentIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
ListView_SetItemState(_hSelf, taskListInfo._currentIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||||
@ -199,6 +190,10 @@ void VerticalFileSwitcherListView::reload()
|
|||||||
{
|
{
|
||||||
removeAll();
|
removeAll();
|
||||||
initList();
|
initList();
|
||||||
|
|
||||||
|
RECT rc;
|
||||||
|
::GetClientRect(_hParent, &rc);
|
||||||
|
resizeColumns(rc.right - rc.left);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferID VerticalFileSwitcherListView::getBufferInfoFromIndex(int index, int & view) const
|
BufferID VerticalFileSwitcherListView::getBufferInfoFromIndex(int index, int & view) const
|
||||||
@ -234,6 +229,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
|
|||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
|
wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
|
||||||
bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
|
bool isPathColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutPathColumn;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
::PathRemoveExtension(fn);
|
::PathRemoveExtension(fn);
|
||||||
@ -256,10 +252,17 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
|
|||||||
tlfs->_fn = buf->getFullPathName();
|
tlfs->_fn = buf->getFullPathName();
|
||||||
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||||
ListView_SetItem(_hSelf, &item);
|
ListView_SetItem(_hSelf, &item);
|
||||||
|
int colIndex = 0;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(buf->getFileName()));
|
ListView_SetItemText(_hSelf, i, ++colIndex, (LPTSTR)::PathFindExtension(buf->getFileName()));
|
||||||
|
}
|
||||||
|
if (isPathColumn)
|
||||||
|
{
|
||||||
|
TCHAR dir[MAX_PATH], drive[MAX_PATH];
|
||||||
|
_wsplitpath_s(buf->getFullPathName(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
|
||||||
|
wcscat_s(drive, dir);
|
||||||
|
ListView_SetItemText(_hSelf, i, ++colIndex, drive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,12 +307,13 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
|
|||||||
int index = ListView_GetItemCount(_hSelf);
|
int index = ListView_GetItemCount(_hSelf);
|
||||||
Buffer *buf = static_cast<Buffer *>(bufferID);
|
Buffer *buf = static_cast<Buffer *>(bufferID);
|
||||||
const TCHAR *fileName = buf->getFileName();
|
const TCHAR *fileName = buf->getFileName();
|
||||||
|
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
|
||||||
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID);
|
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID);
|
||||||
|
|
||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
wcscpy_s(fn, ::PathFindFileName(fileName));
|
wcscpy_s(fn, ::PathFindFileName(fileName));
|
||||||
bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !nppGUI._fileSwitcherWithoutExtColumn;
|
||||||
|
bool isPathColumn = !nppGUI._fileSwitcherWithoutPathColumn;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
::PathRemoveExtension(fn);
|
::PathRemoveExtension(fn);
|
||||||
@ -323,10 +327,17 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
|
|||||||
item.iImage = buf->isMonitoringOn()?3:(buf->isReadOnly()?2:(buf->isDirty()?1:0));
|
item.iImage = buf->isMonitoringOn()?3:(buf->isReadOnly()?2:(buf->isDirty()?1:0));
|
||||||
item.lParam = reinterpret_cast<LPARAM>(tl);
|
item.lParam = reinterpret_cast<LPARAM>(tl);
|
||||||
ListView_InsertItem(_hSelf, &item);
|
ListView_InsertItem(_hSelf, &item);
|
||||||
|
int colIndex = 0;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
ListView_SetItemText(_hSelf, index, 1, ::PathFindExtension(fileName));
|
ListView_SetItemText(_hSelf, index, ++colIndex, ::PathFindExtension(fileName));
|
||||||
|
}
|
||||||
|
if (isPathColumn)
|
||||||
|
{
|
||||||
|
TCHAR dir[MAX_PATH], drive[MAX_PATH];
|
||||||
|
_wsplitpath_s(buf->getFullPathName(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
|
||||||
|
wcscat_s(drive, dir);
|
||||||
|
ListView_SetItemText(_hSelf, index, ++colIndex, drive);
|
||||||
}
|
}
|
||||||
ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
|
ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
|
||||||
|
|
||||||
@ -353,6 +364,14 @@ void VerticalFileSwitcherListView::removeAll()
|
|||||||
{
|
{
|
||||||
remove(i);
|
remove(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND colHeader = reinterpret_cast<HWND>(SendMessage(_hSelf, LVM_GETHEADER, 0, 0));
|
||||||
|
int columnCount = static_cast<int32_t>(SendMessage(colHeader, HDM_GETITEMCOUNT, 0, 0));
|
||||||
|
|
||||||
|
for (int i = 0; i < columnCount; ++i)
|
||||||
|
{
|
||||||
|
ListView_DeleteColumn(_hSelf, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int VerticalFileSwitcherListView::find(BufferID bufferID, int iView) const
|
int VerticalFileSwitcherListView::find(BufferID bufferID, int iView) const
|
||||||
@ -390,16 +409,25 @@ void VerticalFileSwitcherListView::resizeColumns(int totalWidth)
|
|||||||
{
|
{
|
||||||
NppParameters& nppParams = NppParameters::getInstance();
|
NppParameters& nppParams = NppParameters::getInstance();
|
||||||
bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !nppParams.getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
|
bool isPathColumn = !nppParams.getNppGUI()._fileSwitcherWithoutPathColumn;
|
||||||
|
|
||||||
|
const int extWidthDyn = nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherExtWidth);
|
||||||
|
const int pathWidthDyn = nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth);
|
||||||
|
int totalColWidthDynExceptName = 0;
|
||||||
|
int colIndex = 0;
|
||||||
|
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
int extWidthDyn = nppParams._dpiManager.scaleX(50);
|
totalColWidthDynExceptName += extWidthDyn;
|
||||||
ListView_SetColumnWidth(_hSelf, 0, totalWidth - extWidthDyn);
|
ListView_SetColumnWidth(_hSelf, ++colIndex, extWidthDyn);
|
||||||
ListView_SetColumnWidth(_hSelf, 1, extWidthDyn);
|
|
||||||
}
|
}
|
||||||
else
|
if (isPathColumn)
|
||||||
{
|
{
|
||||||
ListView_SetColumnWidth(_hSelf, 0, totalWidth);
|
totalColWidthDynExceptName += pathWidthDyn;
|
||||||
|
ListView_SetColumnWidth(_hSelf, ++colIndex, pathWidthDyn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListView_SetColumnWidth(_hSelf, 0, totalWidth - totalColWidthDynExceptName);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SwitcherFileInfo> VerticalFileSwitcherListView::getSelectedFiles(bool reverse) const
|
std::vector<SwitcherFileInfo> VerticalFileSwitcherListView::getSelectedFiles(bool reverse) const
|
||||||
|
@ -30,6 +30,7 @@ typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrie
|
|||||||
#define FS_ROOTNODE "DocList"
|
#define FS_ROOTNODE "DocList"
|
||||||
#define FS_CLMNNAME "ColumnName"
|
#define FS_CLMNNAME "ColumnName"
|
||||||
#define FS_CLMNEXT "ColumnExt"
|
#define FS_CLMNEXT "ColumnExt"
|
||||||
|
#define FS_CLMNPATH "ColumnPath"
|
||||||
|
|
||||||
struct SwitcherFileInfo {
|
struct SwitcherFileInfo {
|
||||||
BufferID _bufID;
|
BufferID _bufID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user