summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-14 10:28:58 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-14 10:29:21 +0200
commit69718dc5b9359629ae54d47571813fd4a0277206 (patch)
treefac4678359f80986bc9067747cee8da7ccf63943 /src/ui
parent161b6290df993a852bf9acc2c6a671426bd23131 (diff)
Full page scroll with PageUp and PageDown
Added separate keybindings for half page and full page scrolling. Space and Shift+Space do the half page scroll as before. Assigned new keybinding IDs to reset these to defaults in case they've been customized. IssueID #203
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c3
-rw-r--r--src/ui/keys.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 9111b546..79e8b727 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1918,8 +1918,9 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1918 fetchNextUnfetchedImage_DocumentWidget_(d)) { 1918 fetchNextUnfetchedImage_DocumentWidget_(d)) {
1919 return iTrue; 1919 return iTrue;
1920 } 1920 }
1921 const float amount = argLabel_Command(cmd, "full") ? 1.0f : 0.5f;
1921 smoothScroll_DocumentWidget_(d, 1922 smoothScroll_DocumentWidget_(d,
1922 dir * (0.5f * height_Rect(documentBounds_DocumentWidget_(d)) - 1923 dir * (amount * height_Rect(documentBounds_DocumentWidget_(d)) -
1923 0 * lineHeight_Text(paragraph_FontId)), 1924 0 * lineHeight_Text(paragraph_FontId)),
1924 smoothDuration_DocumentWidget_); 1925 smoothDuration_DocumentWidget_);
1925 return iTrue; 1926 return iTrue;
diff --git a/src/ui/keys.c b/src/ui/keys.c
index 60f06f77..4d3f79f7 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -196,8 +196,10 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
196 { 2, { "Jump to bottom", SDLK_END, 0, "scroll.bottom" }, 0 }, 196 { 2, { "Jump to bottom", SDLK_END, 0, "scroll.bottom" }, 0 },
197 { 10, { "Scroll up", SDLK_UP, 0, "scroll.step arg:-1" }, argRepeat_BindFlag }, 197 { 10, { "Scroll up", SDLK_UP, 0, "scroll.step arg:-1" }, argRepeat_BindFlag },
198 { 11, { "Scroll down", SDLK_DOWN, 0, "scroll.step arg:1" }, argRepeat_BindFlag }, 198 { 11, { "Scroll down", SDLK_DOWN, 0, "scroll.step arg:1" }, argRepeat_BindFlag },
199 { 20, { "Scroll up half a page", SDLK_PAGEUP, 0, "scroll.page arg:-1" }, argRepeat_BindFlag }, 199 { 22, { "Scroll up half a page", SDLK_SPACE, KMOD_SHIFT, "scroll.page arg:-1" }, argRepeat_BindFlag },
200 { 21, { "Scroll down half a page", SDLK_PAGEDOWN, 0, "scroll.page arg:1" }, argRepeat_BindFlag }, 200 { 23, { "Scroll down half a page", SDLK_SPACE, 0, "scroll.page arg:1" }, argRepeat_BindFlag },
201 { 24, { "Scroll up a page", SDLK_PAGEUP, 0, "scroll.page arg:-1 full:1" }, argRepeat_BindFlag },
202 { 25, { "Scroll down a page", SDLK_PAGEDOWN, 0, "scroll.page arg:1 full:1" }, argRepeat_BindFlag },
201 { 30, { "Go back", navigateBack_KeyShortcut, "navigate.back" }, 0 }, 203 { 30, { "Go back", navigateBack_KeyShortcut, "navigate.back" }, 0 },
202 { 31, { "Go forward", navigateForward_KeyShortcut, "navigate.forward" }, 0 }, 204 { 31, { "Go forward", navigateForward_KeyShortcut, "navigate.forward" }, 0 },
203 { 32, { "Go to parent directory", navigateParent_KeyShortcut, "navigate.parent" }, 0 }, 205 { 32, { "Go to parent directory", navigateParent_KeyShortcut, "navigate.parent" }, 0 },
@@ -222,8 +224,6 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
222 { 81, { "Next tab", nextTab_KeyShortcut, "tabs.next" }, 0 }, 224 { 81, { "Next tab", nextTab_KeyShortcut, "tabs.next" }, 0 },
223 { 100,{ "Toggle show URL on hover", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 }, 225 { 100,{ "Toggle show URL on hover", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 },
224 /* The following cannot currently be changed (built-in duplicates). */ 226 /* The following cannot currently be changed (built-in duplicates). */
225 { 1000, { NULL, SDLK_SPACE, KMOD_SHIFT, "scroll.page arg:-1" }, argRepeat_BindFlag },
226 { 1001, { NULL, SDLK_SPACE, 0, "scroll.page arg:1" }, argRepeat_BindFlag },
227#if defined (iPlatformApple) 227#if defined (iPlatformApple)
228 { 1002, { NULL, SDLK_LEFTBRACKET, KMOD_PRIMARY, "navigate.back" }, 0 }, 228 { 1002, { NULL, SDLK_LEFTBRACKET, KMOD_PRIMARY, "navigate.back" }, 0 },
229 { 1003, { NULL, SDLK_RIGHTBRACKET, KMOD_PRIMARY, "navigate.forward" }, 0 }, 229 { 1003, { NULL, SDLK_RIGHTBRACKET, KMOD_PRIMARY, "navigate.forward" }, 0 },