mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 23:34:44 +02:00
Fix Mouse Wheel Scrolling in Shortcut Mapper even nothing to scroll
Reduce also Shortcut Mapper memory use. Fix #14895, close #14896
This commit is contained in:
parent
71a12c4289
commit
52fa5a3b8a
@ -1,4 +1,4 @@
|
||||
//BABYGRID code is copyrighted (C) 20002 by David Hillard
|
||||
//BABYGRID code is copyrighted (C) 2002 by David Hillard
|
||||
//
|
||||
//This code must retain this copyright message
|
||||
//
|
||||
@ -23,7 +23,8 @@ HFONT g_hfontbody = nullptr;
|
||||
HFONT g_hfontheader = nullptr;
|
||||
HFONT g_hfonttitle = nullptr;
|
||||
|
||||
#define MAX_GRIDS 20
|
||||
#define MAX_GRIDS 1 // Notepad++ uses only one GridHandleStruct, the old value "20" is not necessary
|
||||
|
||||
struct GridHandleStruct
|
||||
{
|
||||
HMENU gridmenu = nullptr;
|
||||
@ -1174,9 +1175,9 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
PAINTSTRUCT ps{};
|
||||
BeginPaint(hWnd, &ps);
|
||||
RECT rt;
|
||||
RECT rt{};
|
||||
GetClientRect(hWnd, &rt);
|
||||
CalcVisibleCellBoundaries(SelfIndex);
|
||||
//display title
|
||||
@ -1186,11 +1187,11 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
DisplayColumn(hWnd, SelfIndex, 0, 0, BGHS[SelfIndex].hfont, BGHS[SelfIndex].hcolumnheadingfont);
|
||||
{
|
||||
int c, j, k, offset;
|
||||
offset = BGHS[SelfIndex].columnwidths[0];
|
||||
j = BGHS[SelfIndex].leftvisiblecol;
|
||||
k = BGHS[SelfIndex].rightvisiblecol;
|
||||
for (c = j; c <= k; c++)
|
||||
int offset = BGHS[SelfIndex].columnwidths[0];
|
||||
int j = BGHS[SelfIndex].leftvisiblecol;
|
||||
int k = BGHS[SelfIndex].rightvisiblecol;
|
||||
|
||||
for (int c = j; c <= k; c++)
|
||||
{
|
||||
DisplayColumn(hWnd, SelfIndex, c, offset, BGHS[SelfIndex].hfont, BGHS[SelfIndex].hcolumnheadingfont);
|
||||
offset += BGHS[SelfIndex].columnwidths[c];
|
||||
@ -1469,8 +1470,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
//now add it
|
||||
wcscat_s(buffer, TEXT("|"));
|
||||
wcscat_s(buffer, BGHS[SelfIndex].protect);
|
||||
//determine data type (text,numeric, or boolean)(1,2,3)
|
||||
//iDataType=DetermineDataType((TCHAR*)lParam);
|
||||
|
||||
int iDataType = 1;
|
||||
|
||||
@ -1536,7 +1535,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
//if there are \n codes in the generic_string, find the longest line
|
||||
int longestline = FindLongestLine(hdc, (TCHAR*)lParam, &size);
|
||||
//GetTextExtentPoint32(hdc,(TCHAR*)lParam,lstrlen((TCHAR*)lParam),&size);
|
||||
int required_width = longestline + 15;
|
||||
required_height = size.cy;
|
||||
//count lines
|
||||
@ -2149,7 +2147,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (NCC) { NotifyColChanged(hWnd, SelfIndex); }
|
||||
|
||||
DrawCursor(hWnd, SelfIndex);
|
||||
//SetCurrentCellStatus(hWnd,SelfIndex); //redundant
|
||||
SetHomeRow(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
SetHomeCol(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
RefreshGrid(hWnd);
|
||||
@ -2184,7 +2181,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
DrawCursor(hWnd, SelfIndex);
|
||||
|
||||
//SetCurrentCellStatus(hWnd,SelfIndex); //redundant
|
||||
SetHomeRow(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
RefreshGrid(hWnd);
|
||||
BGHS[SelfIndex].EDITING = FALSE;
|
||||
@ -2258,7 +2254,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
NotifyRowChanged(hWnd, SelfIndex);
|
||||
DrawCursor(hWnd, SelfIndex);
|
||||
//SetCurrentCellStatus(hWnd,SelfIndex); //redundant
|
||||
SetHomeRow(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
SetHomeCol(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
RefreshGrid(hWnd);
|
||||
@ -2548,6 +2543,8 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
if (!BGHS[SelfIndex].VSCROLL)
|
||||
return TRUE;
|
||||
short zDelta = (short)HIWORD(wParam);
|
||||
::SendMessage(hWnd, WM_VSCROLL, zDelta < 0 ? SB_LINEDOWN : SB_LINEUP, 0);
|
||||
return TRUE;
|
||||
@ -2601,6 +2598,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (LOWORD(wParam) == SB_LINEDOWN)
|
||||
{
|
||||
RECT gridrect{};
|
||||
@ -2627,8 +2625,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (LOWORD(wParam) == SB_PAGEUP)
|
||||
{
|
||||
RECT gridrect{};
|
||||
@ -2724,7 +2720,6 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
DrawCursor(hWnd, SelfIndex);
|
||||
BGHS[SelfIndex].GRIDHASFOCUS = TRUE;
|
||||
DrawCursor(hWnd, SelfIndex);
|
||||
//SetCurrentCellStatus(hWnd,SelfIndex); //redundant
|
||||
SetHomeRow(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
SetHomeCol(hWnd, SelfIndex, BGHS[SelfIndex].cursorrow, BGHS[SelfIndex].cursorcol);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "BabyGridWrapper.h"
|
||||
|
||||
const TCHAR *babyGridClassName = TEXT("BABYGRID");
|
||||
const wchar_t* babyGridClassName = L"BABYGRID";
|
||||
|
||||
bool BabyGridWrapper::_isRegistered = false;
|
||||
|
||||
@ -37,4 +37,6 @@ void BabyGridWrapper::init(HINSTANCE hInst, HWND parent, int16_t id)
|
||||
reinterpret_cast<HMENU>(id),
|
||||
_hInst,
|
||||
NULL);
|
||||
|
||||
_isRegistered = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user