\fBuse_mouse\fP=[true|false]
Defines if navigation via the mouse is activated. Default is false. Most terminals can also inhibit ncurses mouse events at runtime by holding the Shift key (restoring mouse-selection behavior).
+.TP
+\fBscroll_speed\fP=lines
+Defines the number of lines the adress list is scrolled by on a mouse wheel
+action. This option only takes effect if use_mouse is enabled. Default is 2.
+
.TP
\fBuse_colors\fP=[true|false]
Defines if the output of abook is colorized. Default is false.
int curitem = -1;
int first_list_item = -1;
+int scroll_speed = 2;
char *selected = NULL;
extern abook_field_list *fields_list;
{
list = newwin(LIST_LINES, LIST_COLS, LIST_TOP, 0);
scrollok(list, TRUE);
+ scroll_speed = abs(opt_get_int(INT_SCROLL_SPEED));
}
void
refresh_list();
}
+void
+scroll_list_up()
+{
+ if(first_list_item <= 0)
+ return;
+
+ first_list_item -= scroll_speed;
+ if(first_list_item < 0) {
+ first_list_item = 0;
+ }
+ if(curitem > LAST_LIST_ITEM) {
+ curitem = LAST_LIST_ITEM;
+ }
+
+ refresh_list();
+}
+
+void
+scroll_list_down()
+{
+ if(first_list_item > db_n_items() - 2)
+ return;
+
+ first_list_item += scroll_speed;
+ if(first_list_item >= db_n_items()) {
+ first_list_item = db_n_items() - 1;
+ }
+ if(curitem < first_list_item) {
+ curitem = first_list_item;
+ }
+
+ refresh_list();
+}
void
page_up()
void list_headerline();
void scroll_up();
void scroll_down();
+void scroll_list_up();
+void scroll_list_down();
void page_up();
void page_down();
void select_none();
{ "sort_field", OT_STR, STR_SORT_FIELD, UL "nick" },
{ "show_cursor", OT_BOOL, BOOL_SHOW_CURSOR, FALSE },
{ "use_mouse", OT_BOOL, BOOL_USE_MOUSE, FALSE },
+ { "scroll_speed", OT_INT, INT_SCROLL_SPEED, UL 2 },
{ "use_colors", OT_BOOL, BOOL_USE_COLORS, FALSE },
{ "color_header_fg", OT_STR, STR_COLOR_HEADER_FG, UL "blue" },
{ "color_header_fg", OT_STR, STR_COLOR_HEADER_FG, UL "blue" },
enum int_opts {
INT_EMAILPOS,
INT_EXTRAPOS,
+ INT_SCROLL_SPEED,
INT_MAXIMUM /* INT_MAX conflicts on some systems */
};
refresh_list();
}
} else if(event.bstate & BUTTON4_PRESSED) {
- scroll_up();
+ scroll_list_up();
} else if(event.bstate & BUTTON5_PRESSED) {
- scroll_down();
+ scroll_list_down();
}
}
}