From f34a797bf750c1976c0b971dde70d77cccda96b6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 Nov 2023 14:04:59 +0300 Subject: =?UTF-8?q?fixes=20#3768=20(NewStory:=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8E=20?= =?UTF-8?q?=D1=81=D0=B4=D0=B2=D0=B8=D0=B3=D0=B0=20=D0=B2=D1=8B=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D1=80=D1=83=D1=82=D0=BA=D0=B5=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B5=D0=BB=D0=BA=D0=B0=D0=BC=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/history_control.cpp | 44 ++++++++++++++++++++++++++++---- plugins/NewStory/src/history_control.h | 4 +++ 2 files changed, 43 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index f78c812209..30c674c451 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -704,7 +704,7 @@ void NewstoryListData::ToggleSelection(int iFirst, int iLast) } ///////////////////////////////////////////////////////////////////////////////////////// -// Navigation +// Navigation by coordinates void NewstoryListData::LineUp() { @@ -730,6 +730,40 @@ void NewstoryListData::PageDown() ScrollDown(cachedWindowHeight); } +///////////////////////////////////////////////////////////////////////////////////////// +// Navigation by events + +void NewstoryListData::EventUp() +{ + if (caret > 0) + SetPos(caret - 1); +} + +void NewstoryListData::EventDown() +{ + if (caret < totalCount-1) + SetPos(caret + 1); +} + +void NewstoryListData::EventPageUp() +{ + if (caret >= 10) + SetPos(caret - 10); + else + SetPos(0); +} + +void NewstoryListData::EventPageDown() +{ + if (caret < totalCount - 10) + SetPos(caret + 10); + else + SetPos(totalCount - 1); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Common navigation functions + void NewstoryListData::ScrollBottom() { if (!totalCount) @@ -1008,25 +1042,25 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (wParam) { case VK_UP: - data->LineUp(); + data->EventUp(); break; case VK_DOWN: - data->LineDown(); + data->EventDown(); break; case VK_PRIOR: if (isCtrl) data->ScrollTop(); else - data->PageUp(); + data->EventPageUp(); break; case VK_NEXT: if (isCtrl) data->ScrollBottom(); else - data->PageDown(); + data->EventPageDown(); break; case VK_HOME: diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index b773c43c6b..7e0328532d 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -68,6 +68,10 @@ struct NewstoryListData : public MZeroedObject void Download(int iOptions); void EndEditItem(bool bAccept); void EnsureVisible(int item); + void EventUp(); + void EventDown(); + void EventPageUp(); + void EventPageDown(); int FindNext(const wchar_t *pwszText); int FindPrev(const wchar_t *pwszText); void FixScrollPosition(bool bForce = false); -- cgit v1.2.3