Close doc in document list on middle mouse button up
In 94b83158dc
, closing doc in document list was on middle mouse button down.
This commit make it on middle mouse button up (for aligning with closing tab behaviour in Notepad++, also with OS middle mouse button click behaviour).
This commit is contained in:
parent
94b83158dc
commit
4d107e2691
|
@ -542,7 +542,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
|
||||||
// allocate commandLineStr buffer with the return value + 1, then call it again to get the current command line string.
|
// allocate commandLineStr buffer with the return value + 1, then call it again to get the current command line string.
|
||||||
|
|
||||||
#define NPPM_CREATELEXER (NPPMSG + 110)
|
#define NPPM_CREATELEXER (NPPMSG + 110)
|
||||||
// void* NPPN_CREATELEXER(0, const TCHAR *lexer_name)
|
// void* NPPM_CREATELEXER(0, const TCHAR *lexer_name)
|
||||||
// Returns the ILexer pointer created by Lexilla
|
// Returns the ILexer pointer created by Lexilla
|
||||||
|
|
||||||
#define NPPM_GETBOOKMARKID (NPPMSG + 111)
|
#define NPPM_GETBOOKMARKID (NPPMSG + 111)
|
||||||
|
|
|
@ -45,6 +45,24 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
|
||||||
return (0 - result);
|
return (0 - result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT run_listViewProc(WNDPROC oldEditProc, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
|
||||||
|
case WM_MBUTTONUP:
|
||||||
|
{
|
||||||
|
// Redirect the message to parent
|
||||||
|
::SendMessage(::GetParent(hwnd), WM_PARENTNOTIFY, WM_MBUTTONUP, lParam);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ::CallWindowProc(oldEditProc, hwnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
void VerticalFileSwitcher::startColumnSort()
|
void VerticalFileSwitcher::startColumnSort()
|
||||||
{
|
{
|
||||||
// reset sorting if exts column was just disabled
|
// reset sorting if exts column was just disabled
|
||||||
|
@ -77,6 +95,9 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
_fileListView.initList();
|
_fileListView.initList();
|
||||||
_fileListView.display();
|
_fileListView.display();
|
||||||
|
|
||||||
|
::SetWindowLongPtr(_fileListView.getHSelf(), GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
|
_defaultListViewProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_fileListView.getHSelf(), GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(listViewStaticProc)));
|
||||||
|
|
||||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||||
|
|
||||||
|
@ -89,11 +110,13 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Different from WM_MBUTTONDOWN, WM_MBUTTONUP message is not sent to parent hwnd by WIN32 API
|
||||||
|
// So we subclass listview to redirect WM_MBUTTONUP via WM_PARENTNOTIFY (as WM_MBUTTONDOWN)
|
||||||
case WM_PARENTNOTIFY:
|
case WM_PARENTNOTIFY:
|
||||||
{
|
{
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONUP:
|
||||||
{
|
{
|
||||||
// Get item ID under cursor
|
// Get item ID under cursor
|
||||||
LVHITTESTINFO hitInfo{};
|
LVHITTESTINFO hitInfo{};
|
||||||
|
@ -124,6 +147,7 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
||||||
|
|
|
@ -29,6 +29,8 @@ struct sortCompareData {
|
||||||
int sortDirection = 0;
|
int sortDirection = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LRESULT run_listViewProc(WNDPROC oldEditProc, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
class VerticalFileSwitcher : public DockingDlgInterface {
|
class VerticalFileSwitcher : public DockingDlgInterface {
|
||||||
public:
|
public:
|
||||||
VerticalFileSwitcher(): DockingDlgInterface(IDD_DOCLIST) {};
|
VerticalFileSwitcher(): DockingDlgInterface(IDD_DOCLIST) {};
|
||||||
|
@ -102,14 +104,21 @@ public:
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
HMENU _hGlobalMenu = NULL;
|
HMENU _hGlobalMenu = NULL;
|
||||||
|
|
||||||
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void initPopupMenus();
|
void initPopupMenus();
|
||||||
void popupMenuCmd(int cmdID);
|
void popupMenuCmd(int cmdID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static LRESULT CALLBACK listViewStaticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||||
|
const auto dlg = (VerticalFileSwitcher*)(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||||
|
return (run_listViewProc(dlg->_defaultListViewProc, hwnd, message, wParam, lParam));
|
||||||
|
};
|
||||||
private:
|
private:
|
||||||
bool colHeaderRClick = false;
|
bool colHeaderRClick = false;
|
||||||
int _lastSortingColumn = 0;
|
int _lastSortingColumn = 0;
|
||||||
int _lastSortingDirection = SORT_DIRECTION_NONE;
|
int _lastSortingDirection = SORT_DIRECTION_NONE;
|
||||||
VerticalFileSwitcherListView _fileListView;
|
VerticalFileSwitcherListView _fileListView;
|
||||||
HIMAGELIST _hImaLst = nullptr;
|
HIMAGELIST _hImaLst = nullptr;
|
||||||
|
WNDPROC _defaultListViewProc = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -622,7 +622,7 @@
|
||||||
#define NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 46)
|
#define NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 46)
|
||||||
#define NPPM_INTERNAL_PRNTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 47)
|
#define NPPM_INTERNAL_PRNTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 47)
|
||||||
#define NPPM_INTERNAL_SAVEBACKUP (NOTEPADPLUS_USER_INTERNAL + 48)
|
#define NPPM_INTERNAL_SAVEBACKUP (NOTEPADPLUS_USER_INTERNAL + 48)
|
||||||
#define NPPM_INTERNAL_STOPMONITORING (NOTEPADPLUS_USER_INTERNAL + 49) // Used by Monitoring feature
|
#define NPPM_INTERNAL_STOPMONITORING (NOTEPADPLUS_USER_INTERNAL + 49) // Used by Monitoring feature
|
||||||
#define NPPM_INTERNAL_EDGEBACKGROUND (NOTEPADPLUS_USER_INTERNAL + 50)
|
#define NPPM_INTERNAL_EDGEBACKGROUND (NOTEPADPLUS_USER_INTERNAL + 50)
|
||||||
#define NPPM_INTERNAL_EDGEMULTISETSIZE (NOTEPADPLUS_USER_INTERNAL + 51)
|
#define NPPM_INTERNAL_EDGEMULTISETSIZE (NOTEPADPLUS_USER_INTERNAL + 51)
|
||||||
#define NPPM_INTERNAL_UPDATECLICKABLELINKS (NOTEPADPLUS_USER_INTERNAL + 52)
|
#define NPPM_INTERNAL_UPDATECLICKABLELINKS (NOTEPADPLUS_USER_INTERNAL + 52)
|
||||||
|
|
Loading…
Reference in New Issue