From 7f061572d3f1f897124ebda7a606b3bbf819eac2 Mon Sep 17 00:00:00 2001 From: satbaby Date: Sat, 26 Feb 2011 06:33:39 +0000 Subject: [PATCH] -use right/left pagedown/pageup in timerlist git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1209 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/timerlist.cpp | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 9327d92b4..5e3ee22e9 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -501,7 +501,7 @@ int CTimerList::show() } } else if ( ( msg == CRCInput::RC_timeout ) || - ( msg == CRCInput::RC_home) ) + ( msg == CRCInput::RC_home) || (msg == CRCInput::RC_left) ) { //Exit after timeout or cancel key if ( fadeIn ) { g_RCInput->killTimer(fadeTimer); @@ -516,16 +516,17 @@ int CTimerList::show() } else loop=false; } - else if ((msg == CRCInput::RC_up) && !(timerlist.empty())) + else if ((msg == CRCInput::RC_up || msg == (unsigned int)g_settings.key_channelList_pageup) && !(timerlist.empty())) { - int prevselected=selected; - if (selected==0) - { - selected = timerlist.size()-1; - } - else - selected--; - paintItem(prevselected - liststart); + int step = 0; + int prev_selected = selected; + + step = (msg == (unsigned int)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + selected -= step; + if((prev_selected-step) < 0) // because of uint + selected = timerlist.size() - 1; + + paintItem(prev_selected - liststart); unsigned int oldliststart = liststart; liststart = (selected/listmaxshow)*listmaxshow; if (oldliststart!=liststart) @@ -537,11 +538,23 @@ int CTimerList::show() paintItem(selected - liststart); } } - else if ((msg == CRCInput::RC_down) && !(timerlist.empty())) + else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_channelList_pagedown) && !(timerlist.empty())) { - int prevselected=selected; - selected = (selected+1)%timerlist.size(); - paintItem(prevselected - liststart); + unsigned int step = 0; + int prev_selected = selected; + + step = (msg == (unsigned int)g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + selected += step; + + if(selected >= timerlist.size()) + { + if (((timerlist.size() / listmaxshow) + 1) * listmaxshow == timerlist.size() + listmaxshow) // last page has full entries + selected = 0; + else + selected = ((step == listmaxshow) && (selected < (((timerlist.size() / listmaxshow) + 1) * listmaxshow))) ? (timerlist.size() - 1) : 0; + } + paintItem(prev_selected - liststart); + unsigned int oldliststart = liststart; liststart = (selected/listmaxshow)*listmaxshow; if (oldliststart!=liststart) @@ -553,7 +566,7 @@ int CTimerList::show() paintItem(selected - liststart); } } - else if ((msg == CRCInput::RC_ok) && !(timerlist.empty())) + else if ((msg == CRCInput::RC_right || msg == CRCInput::RC_ok) && !(timerlist.empty())) { if (modifyTimer()==menu_return::RETURN_EXIT_ALL) {