summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewStory/src/history_control.cpp')
-rw-r--r--plugins/NewStory/src/history_control.cpp44
1 files changed, 39 insertions, 5 deletions
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: