[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("")),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst) {
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\
_fileSwitcherWithoutExtColumn(false) {
_appPos.left = 0;
_appPos.top = 0;
_appPos.right = 700;
@ -801,6 +802,7 @@ struct NppGUI
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
generic_string _themeName;
MultiInstSetting _multiInstSetting;
bool _fileSwitcherWithoutExtColumn;
};
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;
::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();
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());
if (index != CB_ERR)
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0);
#endif
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
if (enableDlgTheme)

View File

@ -61,12 +61,17 @@ BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPA
case WM_INITDIALOG :
{
_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 extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
_fileListView.insertColumn(nameStr.c_str(), 150, 0);
_fileListView.insertColumn(extStr.c_str(), 50, 1);
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.initList();
_fileListView.display();

View File

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