make number of lines scrolled with mouse wheel configurable

This commit is contained in:
Andrzej Rybczak
2009-08-09 20:56:15 +02:00
parent ea1edd4d4a
commit dbca4a80ee
5 changed files with 16 additions and 2 deletions

View File

@@ -159,6 +159,8 @@
# #
#cyclic_scrolling = "no" #cyclic_scrolling = "no"
# #
#lines_scrolled = "2"
#
#follow_now_playing_lyrics = "no" #follow_now_playing_lyrics = "no"
# #
#ncmpc_like_songs_adding = "no" (enabled - add/remove, disabled - always add) #ncmpc_like_songs_adding = "no" (enabled - add/remove, disabled - always add)

View File

@@ -129,6 +129,9 @@ If enabled, content of other columns will be updated immediately while scrolling
.B cyclic_scrolling = yes/no .B cyclic_scrolling = yes/no
If enabled, cyclic scrolling is used (e.g. if you press down arrow being at the end of list, it'll take you to the beginning) If enabled, cyclic scrolling is used (e.g. if you press down arrow being at the end of list, it'll take you to the beginning)
.TP .TP
.B lines_scrolled = NUMBER
Number of lines that are scrolled with mouse wheel.
.TP
.B playlist_show_remaining_time = yes/no .B playlist_show_remaining_time = yes/no
If enabled, time remaining to end of playlist will be shown after playlist's statistics. If enabled, time remaining to end of playlist will be shown after playlist's statistics.
.TP .TP

View File

@@ -25,6 +25,7 @@
#include "menu.h" #include "menu.h"
#include "mpdpp.h" #include "mpdpp.h"
#include "helpers.h" #include "helpers.h"
#include "settings.h"
#include "status.h" #include "status.h"
class BasicScreen class BasicScreen
@@ -149,12 +150,12 @@ template <> inline void Screen<Scrollpad>::MouseButtonPressed(MEVENT me)
{ {
if (me.bstate & BUTTON2_PRESSED) if (me.bstate & BUTTON2_PRESSED)
{ {
for (size_t i = 0; i < 2; ++i) for (size_t i = 0; i < Config.lines_scrolled; ++i)
Scroll(wDown); Scroll(wDown);
} }
else if (me.bstate & BUTTON4_PRESSED) else if (me.bstate & BUTTON4_PRESSED)
{ {
for (size_t i = 0; i < 2; ++i) for (size_t i = 0; i < Config.lines_scrolled; ++i)
Scroll(wUp); Scroll(wUp);
} }
} }

View File

@@ -293,6 +293,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
conf.message_delay_time = 4; conf.message_delay_time = 4;
conf.lyrics_db = 0; conf.lyrics_db = 0;
conf.regex_type = 0; conf.regex_type = 0;
conf.lines_scrolled = 2;
} }
void ReadKeys(ncmpcpp_keys &keys) void ReadKeys(ncmpcpp_keys &keys)
@@ -708,6 +709,11 @@ void ReadConfiguration(ncmpcpp_config &conf)
conf.lyrics_db = n < Lyrics::DBs ? n : 0; conf.lyrics_db = n < Lyrics::DBs ? n : 0;
} }
} }
else if (cl.find("lines_scrolled") != std::string::npos)
{
if (!v.empty())
conf.lines_scrolled = StrToInt(v);
}
else if (cl.find("song_window_title_format") != std::string::npos) else if (cl.find("song_window_title_format") != std::string::npos)
{ {
if (!v.empty()) if (!v.empty())

View File

@@ -196,6 +196,8 @@ struct ncmpcpp_config
int message_delay_time; int message_delay_time;
int lyrics_db; int lyrics_db;
int regex_type; int regex_type;
unsigned lines_scrolled;
}; };
extern ncmpcpp_config Config; extern ncmpcpp_config Config;