[ENHANCE] Make extension column optional in vertical file switcher (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1167 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-01-04 21:22:39 +00:00
parent d98d0fa12b
commit f9e917b707
4 changed files with 43 additions and 21 deletions

View File

@ -702,8 +702,9 @@ struct NppGUI
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\ _isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\ _doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\ _autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false), _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst) { _smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\
_fileSwitcherWithoutExtColumn(false) {
_appPos.left = 0; _appPos.left = 0;
_appPos.top = 0; _appPos.top = 0;
_appPos.right = 700; _appPos.right = 700;
@ -801,6 +802,7 @@ struct NppGUI
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
generic_string _themeName; generic_string _themeName;
MultiInstSetting _multiInstSetting; MultiInstSetting _multiInstSetting;
bool _fileSwitcherWithoutExtColumn;
}; };
struct ScintillaViewParams struct ScintillaViewParams

View File

@ -344,10 +344,6 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
bool showDocSwitcher = ::SendMessage(::GetParent(_hParent), NPPM_ISDOCSWITCHERSHOWN, 0, 0) == TRUE; bool showDocSwitcher = ::SendMessage(::GetParent(_hParent), NPPM_ISDOCSWITCHERSHOWN, 0, 0) == TRUE;
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH, BM_SETCHECK, showDocSwitcher, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCSWITCH, BM_SETCHECK, showDocSwitcher, 0);
#ifndef UNICODE
::EnableWindow(::GetDlgItem(_hSelf, IDC_LOCALIZATION_GB_STATIC), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_LOCALIZATION), FALSE);
#else
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i) for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i)
@ -366,7 +362,6 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lang.c_str()); int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lang.c_str());
if (index != CB_ERR) if (index != CB_ERR)
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0);
#endif
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)

View File

@ -61,12 +61,17 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
_fileListView.init(_hInst, _hSelf, _hImaLst); _fileListView.init(_hInst, _hSelf, _hImaLst);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NppParameters *nppParams = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParams->getNativeLangSpeaker();
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME); generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
_fileListView.insertColumn(nameStr.c_str(), 150, 0); _fileListView.insertColumn(nameStr.c_str(), 150, 0);
bool isExtColumn = nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
_fileListView.insertColumn(extStr.c_str(), 50, 1); _fileListView.insertColumn(extStr.c_str(), 50, 1);
}
_fileListView.initList(); _fileListView.initList();
_fileListView.display(); _fileListView.display();

View File

@ -103,8 +103,11 @@ void VerticalFileSwitcherListView::initList()
TCHAR fn[MAX_PATH]; TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str())); lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
bool isExtColumn = (NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
::PathRemoveExtension(fn); ::PathRemoveExtension(fn);
}
LVITEM item; LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
@ -114,9 +117,12 @@ void VerticalFileSwitcherListView::initList()
item.iImage = fileNameStatus._status; item.iImage = fileNameStatus._status;
item.lParam = (LPARAM)tl; item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item); ListView_InsertItem(_hSelf, &item);
if (isExtColumn)
{
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(fileNameStatus._fn.c_str())); ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(fileNameStatus._fn.c_str()));
} }
} }
}
int VerticalFileSwitcherListView::getBufferInfoFromIndex(int index, int & view) const int VerticalFileSwitcherListView::getBufferInfoFromIndex(int index, int & view) const
{ {
@ -150,8 +156,11 @@ void VerticalFileSwitcherListView::setItemIconStatus(int bufferID)
TCHAR fn[MAX_PATH]; TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(buf->getFileName())); lstrcpy(fn, ::PathFindFileName(buf->getFileName()));
bool isExtColumn = (NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
::PathRemoveExtension(fn); ::PathRemoveExtension(fn);
}
LVITEM item; LVITEM item;
item.pszText = fn; item.pszText = fn;
item.iSubItem = 0; item.iSubItem = 0;
@ -169,7 +178,12 @@ void VerticalFileSwitcherListView::setItemIconStatus(int bufferID)
{ {
item.mask = LVIF_TEXT | LVIF_IMAGE; item.mask = LVIF_TEXT | LVIF_IMAGE;
ListView_SetItem(_hSelf, &item); ListView_SetItem(_hSelf, &item);
if (isExtColumn)
{
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(buf->getFileName())); ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(buf->getFileName()));
}
} }
} }
} }
@ -222,8 +236,11 @@ int VerticalFileSwitcherListView::add(int bufferID, int iView)
TCHAR fn[MAX_PATH]; TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileName)); lstrcpy(fn, ::PathFindFileName(fileName));
bool isExtColumn = (NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
::PathRemoveExtension(fn); ::PathRemoveExtension(fn);
}
LVITEM item; LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
@ -234,7 +251,10 @@ int VerticalFileSwitcherListView::add(int bufferID, int iView)
item.lParam = (LPARAM)tl; item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item); ListView_InsertItem(_hSelf, &item);
if (isExtColumn)
{
ListView_SetItemText(_hSelf, index, 1, ::PathFindExtension(fileName)); ListView_SetItemText(_hSelf, index, 1, ::PathFindExtension(fileName));
}
ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED); ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
return index; return index;