Enable/disable ext column from Document list directely

* Enable/disable ext column via the context menu.
* The ext column checkbox is removed from the preferences dialog.
* Cleaned up localization file

Fix #10468, close #10485
This commit is contained in:
Ashfaaq18 2021-09-01 20:36:44 +05:30 committed by Don Ho
parent 55f2644953
commit ef8522e4aa
8 changed files with 63 additions and 23 deletions

View File

@ -838,9 +838,6 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6122" name="Hide menu bar (use Alt or F10 key to toggle)"/>
<Item id="6123" name="Localization"/>
<Item id="6125" name="Document List Panel"/>
<Item id="6127" name="Disable extension column"/>
<Item id="6128" name="Alternate icons"/>
</Global>
<Scintillas title="Editing">

View File

@ -46,9 +46,6 @@ BEGIN
CONTROL "Filled Fluent UI: small",IDC_RADIO_SMALLICON2,"Button",BS_AUTORADIOBUTTON,64,73,114,10
CONTROL "Filled Fluent UI: large",IDC_RADIO_BIGICON2,"Button",BS_AUTORADIOBUTTON,64,87,109,10
CONTROL "Standard icons: small",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,64,101,119,10
GROUPBOX "Document List Panel",IDC_DOCLIST_GB_STATIC,57,125,147,37,BS_CENTER
CONTROL "Disable extension column",IDC_CHECK_DOCLIST_NOEXTCOLUMN,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,64,140,124,10
GROUPBOX "Tab Bar",IDC_TABBAR_GB_STATIC,223,6,176,156,BS_CENTER
CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,15,108,10
CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,29,134,10
@ -65,7 +62,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,132,133,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,145,165,10
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,169,130,10
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,132,130,10
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,223,169,218,10
END

View File

@ -475,8 +475,6 @@ INT_PTR CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWSTATUSBAR, BM_SETCHECK, showStatus, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDEMENUBAR, BM_SETCHECK, !showMenu, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCLIST_NOEXTCOLUMN, BM_SETCHECK, nppGUI._fileSwitcherWithoutExtColumn, 0);
LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher();
for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i)
@ -544,13 +542,6 @@ INT_PTR CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
}
return TRUE;
case IDC_CHECK_DOCLIST_NOEXTCOLUMN :
{
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCLIST_NOEXTCOLUMN, BM_GETCHECK, 0, 0));
::SendMessage(::GetParent(_hParent), NPPM_DOCLISTDISABLECOLUMN, 0, isChecked?TRUE:FALSE);
}
return TRUE;
case IDC_CHECK_TAB_HIDE :
{
bool toBeHidden = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_TAB_HIDE), BM_GETCHECK, 0, 0));

View File

@ -51,8 +51,6 @@
#define IDC_CHECK_HIDEMENUBAR (IDD_PREFERENCE_SUB_GENRAL + 22)
#define IDC_LOCALIZATION_GB_STATIC (IDD_PREFERENCE_SUB_GENRAL + 23)
#define IDC_COMBO_LOCALIZATION (IDD_PREFERENCE_SUB_GENRAL + 24)
#define IDC_DOCLIST_GB_STATIC (IDD_PREFERENCE_SUB_GENRAL + 25)
#define IDC_CHECK_DOCLIST_NOEXTCOLUMN (IDD_PREFERENCE_SUB_GENRAL + 27)
#define IDC_CHECK_TAB_ALTICONS (IDD_PREFERENCE_SUB_GENRAL + 28)
#define IDC_RADIO_SMALLICON2 (IDD_PREFERENCE_SUB_GENRAL + 29)
#define IDC_RADIO_BIGICON2 (IDD_PREFERENCE_SUB_GENRAL + 30)

View File

@ -20,6 +20,12 @@
#include "menuCmdID.h"
#include "Parameters.h"
#include "resource.h"
#include "localization.h"
#define GET_X_LPARAM(lp) static_cast<short>(LOWORD(lp))
#define GET_Y_LPARAM(lp) static_cast<short>(HIWORD(lp))
#define CLMNEXT_ID 1
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
@ -64,6 +70,8 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
{
case WM_INITDIALOG :
{
VerticalFileSwitcher::initPopupMenus();
_fileListView.init(_hInst, _hSelf, _hImaLst);
_fileListView.initList();
_fileListView.display();
@ -127,7 +135,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
if (lpnmitem->hdr.hwndFrom != _fileListView.getHSelf())
{
// Do nothing
colHeaderRClick = true;
return TRUE;
}
@ -226,9 +234,26 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
break;
}
case WM_CONTEXTMENU:
{
if (nbSelectedFiles() == 0 || colHeaderRClick)
{
::TrackPopupMenu(_hGlobalMenu, TPM_LEFTALIGN, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, _hSelf, NULL);
colHeaderRClick = false;
}
return TRUE;
}
case WM_COMMAND:
{
popupMenuCmd(LOWORD(wParam));
break;
}
case WM_DESTROY:
{
_fileListView.destroy();
::DestroyMenu(_hGlobalMenu);
break;
}
@ -238,6 +263,33 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
void VerticalFileSwitcher::initPopupMenus()
{
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
_hGlobalMenu = ::CreatePopupMenu();
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, CLMNEXT_ID, extStr.c_str());
bool isExtColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutExtColumn;
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | isExtColumn ? MF_UNCHECKED : MF_CHECKED);
}
void VerticalFileSwitcher::popupMenuCmd(int cmdID)
{
switch (cmdID)
{
case CLMNEXT_ID:
{
bool& isExtColumn = NppParameters::getInstance().getNppGUI()._fileSwitcherWithoutExtColumn;
isExtColumn = !isExtColumn;
::CheckMenuItem(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | isExtColumn ? MF_UNCHECKED : MF_CHECKED);
reload();
}
break;
}
}
void VerticalFileSwitcher::activateDoc(TaskLstFnStatus *tlfs) const
{

View File

@ -101,8 +101,13 @@ public:
_fileListView.setForegroundColor(fgColour);
};
protected:
HMENU _hGlobalMenu = NULL;
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
void initPopupMenus();
void popupMenuCmd(int cmdID);
private:
bool colHeaderRClick = false;
int _lastSortingColumn = 0;
int _lastSortingDirection = SORT_DIRECTION_NONE;
VerticalFileSwitcherListView _fileListView;

View File

@ -20,10 +20,6 @@
#include "Buffer.h"
#include "localization.h"
#define FS_ROOTNODE "DocList"
#define FS_CLMNNAME "ColumnName"
#define FS_CLMNEXT "ColumnExt"
void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst)
{
Window::init(hInst, parent);

View File

@ -27,6 +27,10 @@ typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrie
#define SORT_DIRECTION_UP 0
#define SORT_DIRECTION_DOWN 1
#define FS_ROOTNODE "DocList"
#define FS_CLMNNAME "ColumnName"
#define FS_CLMNEXT "ColumnExt"
struct SwitcherFileInfo {
BufferID _bufID;
int _iView;