Introduced page-wise scrolling

It is now possible to scroll one page or an half page up or down.
This commit is contained in:
Moritz Lipp 2010-06-14 17:13:18 +02:00
parent b61b8ac2b6
commit a59443af05
3 changed files with 26 additions and 1 deletions

View File

@ -69,6 +69,10 @@ Shortcut shortcuts[] = {
{GDK_CONTROL_MASK, GDK_q, sc_quit, -1, {0} },
{GDK_CONTROL_MASK, GDK_c, sc_abort, -1, {0} },
{GDK_CONTROL_MASK, GDK_i, sc_recolor, NORMAL, {0} },
{GDK_CONTROL_MASK, GDK_d, sc_scroll, NORMAL, { HALF_DOWN } },
{GDK_CONTROL_MASK, GDK_u, sc_scroll, NORMAL, { HALF_UP } },
{GDK_CONTROL_MASK, GDK_f, sc_scroll, NORMAL, { FULL_DOWN } },
{GDK_CONTROL_MASK, GDK_b, sc_scroll, NORMAL, { FULL_UP } },
{0, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
{GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
{GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, NORMAL, { .data = "?" } },

View File

@ -27,6 +27,18 @@ Scroll upwards
.B j
Scroll downwards
.TP
.B ^f
Scroll page down
.TP
.B ^b
Scroll page up
.TP
.B ^d
Scroll half a page down
.TP
.B ^u
Scroll half a page up
.TP
.B l
Scroll to the right
.TP

View File

@ -27,7 +27,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN,
FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
ADJUST_NONE, CONTINUOUS, DELETE_LAST, ADD_MARKER,
EVAL_MARKER, INDEX, EXPAND, COLLAPSE, SELECT,
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, FULLSCREEN };
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, FULLSCREEN,
HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN };
/* typedefs */
struct CElement
@ -1615,6 +1616,14 @@ sc_scroll(Argument* argument)
arg.n = NEXT;
sc_navigate(&arg);
}
else if(argument->n == FULL_UP)
gtk_adjustment_set_value(adjustment, (value - view_size) < 0 ? 0 : (value - view_size));
else if(argument->n == FULL_DOWN)
gtk_adjustment_set_value(adjustment, (value + view_size) > max ? max : (value + view_size));
else if(argument->n == HALF_UP)
gtk_adjustment_set_value(adjustment, (value - (view_size / 2)) < 0 ? 0 : (value - (view_size / 2)));
else if(argument->n == HALF_DOWN)
gtk_adjustment_set_value(adjustment, (value + (view_size / 2)) > max ? max : (value + (view_size / 2)));
else if((argument->n == LEFT) || (argument->n == UP))
gtk_adjustment_set_value(adjustment, (value - SCROLL_STEP) < 0 ? 0 : (value - SCROLL_STEP));
else if(argument->n == TOP)