Commit afd63ac0 authored by Philipp Erhardt's avatar Philipp Erhardt
Browse files

Improve controls

auto_* removed, every action now has a fallback for layouts that don't
support smooth scrolling.
Half and full screen scrolling added.
parent 19041ea8
......@@ -32,16 +32,20 @@ Canvas::Canvas(Viewer *v, QWidget *parent) :
mouse_wheel_factor = config->get_value("mouse_wheel_factor").toInt();
smooth_scroll_delta = config->get_value("smooth_scroll_delta").toInt();
screen_scroll_factor = config->get_value("screen_scroll_factor").toFloat();
// setup keys
add_action("set_presentation_layout", SLOT(set_presentation_layout()));
add_action("set_grid_layout", SLOT(set_grid_layout()));
add_action("page_down", SLOT(page_down()));
add_action("page_up", SLOT(page_up()));
add_action("page_down", SLOT(page_down()));
add_action("page_first", SLOT(page_first()));
add_action("page_last", SLOT(page_last()));
add_action("focus_goto", SLOT(focus_goto()));
add_action("auto_smooth_up", SLOT(auto_smooth_up()));
add_action("auto_smooth_down", SLOT(auto_smooth_down()));
add_action("half_screen_up", SLOT(half_screen_up()));
add_action("half_screen_down", SLOT(half_screen_down()));
add_action("screen_up", SLOT(screen_up()));
add_action("screen_down", SLOT(screen_down()));
add_action("smooth_up", SLOT(smooth_up()));
add_action("smooth_down", SLOT(smooth_down()));
add_action("smooth_left", SLOT(smooth_left()));
add_action("smooth_right", SLOT(smooth_right()));
add_action("zoom_in", SLOT(zoom_in()));
......@@ -56,6 +60,7 @@ Canvas::Canvas(Viewer *v, QWidget *parent) :
add_action("previous_hit", SLOT(previous_hit()));
add_action("next_invisible_hit", SLOT(next_invisible_hit()));
add_action("previous_invisible_hit", SLOT(previous_invisible_hit()));
add_action("focus_goto", SLOT(focus_goto()));
add_action("rotate_left", SLOT(rotate_left()));
add_action("rotate_right", SLOT(rotate_right()));
......@@ -200,6 +205,7 @@ void Canvas::set_grid_layout() {
update();
}
// general movement
void Canvas::page_up() {
if (layout->scroll_page(-1)) {
update();
......@@ -224,44 +230,84 @@ void Canvas::page_last() {
}
}
void Canvas::auto_smooth_up() {
void Canvas::half_screen_up() {
if (layout->supports_smooth_scrolling()) {
smooth_up();
} else {
if (layout->scroll_smooth(0, height() * 0.5f)) {
update();
}
} else { // fallback
page_up();
}
}
void Canvas::auto_smooth_down() {
void Canvas::half_screen_down() {
if (layout->supports_smooth_scrolling()) {
smooth_down();
} else {
if (layout->scroll_smooth(0, -height() * 0.5f)) {
update();
}
} else { // fallback
page_down();
}
}
void Canvas::screen_up() {
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(0, height() * screen_scroll_factor)) {
update();
}
} else { // fallback
page_up();
}
}
void Canvas::screen_down() {
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(0, -height() * screen_scroll_factor)) {
update();
}
} else { // fallback
page_down();
}
}
void Canvas::smooth_up() {
if (layout->scroll_smooth(0, smooth_scroll_delta)) {
update();
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(0, smooth_scroll_delta)) {
update();
}
} else { // fallback
page_up();
}
}
void Canvas::smooth_down() {
if (layout->scroll_smooth(0, -smooth_scroll_delta)) {
update();
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(0, -smooth_scroll_delta)) {
update();
}
} else { // fallback
page_down();
}
}
void Canvas::smooth_left() {
if (layout->scroll_smooth(smooth_scroll_delta, 0)) {
update();
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(smooth_scroll_delta, 0)) {
update();
}
} else { // fallback
page_up();
}
}
void Canvas::smooth_right() {
if (layout->scroll_smooth(-smooth_scroll_delta, 0)) {
update();
if (layout->supports_smooth_scrolling()) {
if (layout->scroll_smooth(-smooth_scroll_delta, 0)) {
update();
}
} else { // fallback
page_down();
}
}
......
......@@ -52,8 +52,10 @@ private slots:
void page_down();
void page_first();
void page_last();
void auto_smooth_up();
void auto_smooth_down();
void half_screen_up();
void half_screen_down();
void screen_up();
void screen_down();
void smooth_up();
void smooth_down();
void smooth_left();
......@@ -92,6 +94,7 @@ private:
// config options
int mouse_wheel_factor;
int smooth_scroll_delta;
float screen_scroll_factor;
};
#endif
......
......@@ -10,6 +10,7 @@ CFG::CFG() :
// canvas options
defaults["mouse_wheel_factor"] = 120; // (qt-)delta for turning the mouse wheel 1 click
defaults["smooth_scroll_delta"] = 30; // pixel scroll offset
defaults["screen_scroll_factor"] = 0.9; // creates overlap for scrolling 1 screen down, should be <= 1
// layout options
defaults["useless_gap"] = 2;
defaults["min_page_width"] = 150;
......@@ -29,15 +30,18 @@ CFG::CFG() :
// canvas keys
keys["set_presentation_layout"] = QStringList() << "1";
keys["set_grid_layout"] = QStringList() << "2";
keys["page_down"] = QStringList() << "Space" << "PgDown" << "Down";
keys["page_up"] = QStringList() << "Backspace" << "PgUp" << "Up";
keys["page_up"] = QStringList() << "PgUp";
keys["page_down"] = QStringList() << "PgDown";
keys["page_first"] = QStringList() << "G";
keys["page_last"] = QStringList() << "Shift+G";
keys["focus_goto"] = QStringList() << "Ctrl+G";
keys["auto_smooth_up"] = QStringList() << "K";
keys["auto_smooth_down"] = QStringList() << "J";
keys["smooth_left"] = QStringList() << "H";
keys["smooth_right"] = QStringList() << "L";
keys["half_screen_up"] = QStringList() << "Ctrl+U";
keys["half_screen_down"] = QStringList() << "Ctrl+D";
keys["screen_up"] = QStringList() << "Backspace" << "Ctrl+B";
keys["screen_down"] = QStringList() << "Space" << "Ctrl+F";
keys["smooth_up"] = QStringList() << "Up" << "K";
keys["smooth_down"] = QStringList() << "Down" << "J";
keys["smooth_left"] = QStringList() << "Left" << "H";
keys["smooth_right"] = QStringList() << "Right" << "L";
keys["zoom_in"] = QStringList() << "=" << "+";
keys["zoom_out"] = QStringList() << "-";
keys["reset_zoom"] = QStringList() << "Z";
......@@ -50,6 +54,7 @@ CFG::CFG() :
keys["previous_hit"] = QStringList() << "Shift+N";
keys["next_invisible_hit"] = QStringList() << "Ctrl+N";
keys["previous_invisible_hit"] = QStringList() << "Ctrl+Shift+N";
keys["focus_goto"] = QStringList() << "Ctrl+G";
keys["rotate_left"] = QStringList() << "U";
keys["rotate_right"] = QStringList() << "I";
// viewer keys
......
......@@ -34,6 +34,11 @@ OPTIONS
*-h*, *--help*::
Print help and exit.
CONFIGURATION
-------------
Variables and key bindings can be changed by modifying the katarakt.ini file.
By default it is read from '$XDG_CONFIG_HOME'.
KEY BINDINGS
------------
*q* ::
......@@ -45,10 +50,15 @@ KEY BINDINGS
Switch to 'grid layout'. Views pages in a continuous fashion, scaled to fit
the width. Supports columns.
*Up*, *Down*, *PgUp*, *PgDown*, *BackSpace*, *Space* ::
Move from page to page
*h*, *j*, *k*, *l* ::
Move smoothly
*Up*, *Down*, *Left*, *Right*, *k*, *j*, *h*, *l* ::
Move around (up/down/left/right)
*\^u*, *^d* ::
Scroll up/down half the screen
*BackSpace*, *Space*, *\^b*, *^f* ::
Scroll up/down the screen. By default scrolls 90% to create an overlapping region
*PgUp*, *PgDown* ::
Scroll up/down one page. Kind of swaps the pages in place
*g*, *G* ::
Go to the first/last page
*^g* ::
......@@ -74,10 +84,37 @@ KEY BINDINGS
*u*, *i* ::
Rotate pages left/right
CONFIGURATION
-------------
Variables and key bindings can be changed by modifying the katarakt.ini file.
By default it is read from '$XDG_CONFIG_HOME'.
VARIABLES
---------
'int' *mouse_wheel_factor* ::
120: QT delta for turning the mouse wheel 1 click
'int' *smooth_scroll_delta* ::
30: pixel offset when moving around
'float' *screen_scroll_factor* ::
0.9: factor for scrolling the screen. Should be \<= 1 to create an overlapping region
'int' *useless_gap* ::
2: gap between two pages in pixels
'int' *min_page_width* ::
150: pages can not be smaller than this
'int' *min_zoom* ::
-14: smallest zoom value
'int' *max_zoom* ::
30: biggest zoom value
'float' *zoom_factor* ::
0.05: influences the number of steps between min and max
'int' *prefetch_count* ::
3: number of pages exceeding the currently visible ones to render, back- and forwards respectively
'float' *search_padding* ::
0.2: factor of the area on the screen to display search hits in. Moves search hits towards the center
'bool' *smooth_downscaling* ::
true: enables the higher quality downsampling filter
'int' *thumbnail_size* ::
32: one dimension of square thumbnails saved at run-time for every page that was once rendered
'int' *rect_expansion* ::
2: number of pixels search rects are expanded by
COMMUNITY
---------
......
[Settings]
mouse_wheel_factor=120
smooth_scroll_delta=30
screen_scroll_factor=0.9
useless_gap=2
min_page_width=150
min_zoom=-14
......@@ -15,15 +16,18 @@ rect_expansion=2
[Keys]
set_presentation_layout=1
set_grid_layout=2
page_down=Space, PgDown, Down
page_up=Backspace, PgUp, Up
page_up=PgUp
page_down=PgDown
page_first=G
page_last=Shift+G
focus_goto=Ctrl+G
auto_smooth_up=K
auto_smooth_down=J
smooth_left=H
smooth_right=L
half_screen_up=Ctrl+U
half_screen_down=Ctrl+D
screen_up=Backspace, Ctrl+B
screen_down=Space, Ctrl+F
smooth_up=Up, K
smooth_down=Down, J
smooth_left=Left, H
smooth_right=Right, L
zoom_in="=", +
zoom_out=-
reset_zoom=Z
......@@ -36,6 +40,7 @@ next_hit=N
previous_hit=Shift+N
next_invisible_hit=Ctrl+N
previous_invisible_hit=Ctrl+Shift+N
focus_goto=Ctrl+G
rotate_left=U
rotate_right=I
toggle_fullscreen=F
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment