add the ability to horizontally scroll half or full screen

This commit is contained in:
Géraud Le Falher 2012-02-25 14:31:35 +01:00 committed by Sebastian Ramacher
parent d85d6a1996
commit ead85e28f1
4 changed files with 20 additions and 6 deletions

View file

@ -162,10 +162,14 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, NORMAL, UP, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, NORMAL, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, NORMAL, DOWN, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, NORMAL, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, NORMAL, RIGHT, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, NORMAL, RIGHT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, NORMAL, HALF_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, NORMAL, HALF_DOWN, NULL); girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, NORMAL, HALF_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, NORMAL, HALF_UP, NULL); girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, NORMAL, HALF_UP, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_y, NULL, sc_scroll, NORMAL, HALF_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_t, NULL, sc_scroll, NORMAL, FULL_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL); girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, NORMAL, FULL_UP, NULL); girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_y, NULL, sc_scroll, NORMAL, FULL_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_UP, NULL); girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
@ -257,6 +261,10 @@ config_load_default(zathura_t* zathura)
girara_argument_mapping_add(gsession, "full-up", FULL_UP); girara_argument_mapping_add(gsession, "full-up", FULL_UP);
girara_argument_mapping_add(gsession, "half-down", HALF_DOWN); girara_argument_mapping_add(gsession, "half-down", HALF_DOWN);
girara_argument_mapping_add(gsession, "half-up", HALF_UP); girara_argument_mapping_add(gsession, "half-up", HALF_UP);
girara_argument_mapping_add(gsession, "full-right", FULL_RIGHT);
girara_argument_mapping_add(gsession, "full-left", FULL_LEFT);
girara_argument_mapping_add(gsession, "half-right", HALF_RIGHT);
girara_argument_mapping_add(gsession, "half-left", HALF_LEFT);
girara_argument_mapping_add(gsession, "in", ZOOM_IN); girara_argument_mapping_add(gsession, "in", ZOOM_IN);
girara_argument_mapping_add(gsession, "left", LEFT); girara_argument_mapping_add(gsession, "left", LEFT);
girara_argument_mapping_add(gsession, "next", NEXT); girara_argument_mapping_add(gsession, "next", NEXT);

View file

@ -423,7 +423,8 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
} }
GtkAdjustment* adjustment = NULL; GtkAdjustment* adjustment = NULL;
if ( (argument->n == LEFT) || (argument->n == RIGHT) ) { if ( (argument->n == LEFT) || (argument->n == FULL_LEFT) || (argument->n == HALF_LEFT) ||
(argument->n == RIGHT) || (argument->n == FULL_RIGHT) || (argument->n == HALF_RIGHT)) {
adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
} else { } else {
adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
@ -441,15 +442,19 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
switch(argument->n) { switch(argument->n) {
case FULL_UP: case FULL_UP:
case FULL_LEFT:
new_value = value - view_size - padding; new_value = value - view_size - padding;
break; break;
case FULL_DOWN: case FULL_DOWN:
case FULL_RIGHT:
new_value = value + view_size + padding; new_value = value + view_size + padding;
break; break;
case HALF_UP: case HALF_UP:
case HALF_LEFT:
new_value = value - ((view_size + padding) / 2); new_value = value - ((view_size + padding) / 2);
break; break;
case HALF_DOWN: case HALF_DOWN:
case HALF_RIGHT:
new_value = value + ((view_size + padding) / 2); new_value = value + ((view_size + padding) / 2);
break; break;
case LEFT: case LEFT:

View file

@ -49,10 +49,10 @@ h, k, j, l
Scroll to the left, down, up or right direction Scroll to the left, down, up or right direction
Left, Down, Up, Right Left, Down, Up, Right
Scroll to the left, down, up or right direction Scroll to the left, down, up or right direction
^d, ^u ^t, ^d, ^u, ^y
Scroll a half page down or up Scroll a half page left, down, up or right
^f, ^b, space, <S-space> t, ^f, ^b, space, <S-space>, y
Scroll a full page down or up Scroll a full page left, down, up or right
gg, G, nG gg, G, nG
Goto to the first, the last or to the nth page Goto to the first, the last or to the nth page
^c, Escape ^c, Escape

View file

@ -16,7 +16,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST,
ADD_MARKER, EVAL_MARKER, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE, SELECT, ADD_MARKER, EVAL_MARKER, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE, SELECT,
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP, GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
FULL_DOWN, NEXT_CHAR, PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH }; FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR, PREVIOUS_CHAR,
DELETE_TO_LINE_START, APPEND_FILEPATH };
/* forward declaration for types from document.h */ /* forward declaration for types from document.h */
struct zathura_document_s; struct zathura_document_s;