mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
gui/channellist.cpp: reuse code as updateSelection()
Origin commit data
------------------
Commit: 3d5d834f3c
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-04 (Wed, 04 Apr 2012)
This commit is contained in:
@@ -517,6 +517,31 @@ void CChannelList::calcSize()
|
|||||||
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2;
|
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CChannelList::updateSelection(int newpos)
|
||||||
|
{
|
||||||
|
bool actzap = false;
|
||||||
|
if((int) selected != newpos) {
|
||||||
|
int prev_selected = selected;
|
||||||
|
unsigned int oldliststart = liststart;
|
||||||
|
|
||||||
|
selected = newpos;
|
||||||
|
liststart = (selected/listmaxshow)*listmaxshow;
|
||||||
|
if (oldliststart != liststart)
|
||||||
|
paint();
|
||||||
|
else {
|
||||||
|
paintItem(prev_selected - liststart);
|
||||||
|
paintItem(selected - liststart);
|
||||||
|
showChannelLogo();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->new_mode_active && SameTP()) {
|
||||||
|
actzap = true;
|
||||||
|
zapTo(selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return actzap;
|
||||||
|
}
|
||||||
|
|
||||||
#define CHANNEL_SMSKEY_TIMEOUT 800
|
#define CHANNEL_SMSKEY_TIMEOUT 800
|
||||||
/* return: >= 0 to zap, -1 on cancel, -3 on list mode change, -4 list edited, -2 zap but no restore old list/chan ?? */
|
/* return: >= 0 to zap, -1 on cancel, -3 on list mode change, -4 list edited, -2 zap but no restore old list/chan ?? */
|
||||||
int CChannelList::show()
|
int CChannelList::show()
|
||||||
@@ -644,84 +669,36 @@ int CChannelList::show()
|
|||||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]);
|
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]);
|
||||||
}
|
}
|
||||||
else if (msg == (neutrino_msg_t) g_settings.key_list_start) {
|
else if (msg == (neutrino_msg_t) g_settings.key_list_start) {
|
||||||
selected=0;
|
actzap = updateSelection(0);
|
||||||
liststart = (selected/listmaxshow)*listmaxshow;
|
|
||||||
paint();
|
|
||||||
if(this->new_mode_active && SameTP()) {
|
|
||||||
actzap = true;
|
|
||||||
zapTo(selected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (msg == (neutrino_msg_t) g_settings.key_list_end) {
|
else if (msg == (neutrino_msg_t) g_settings.key_list_end) {
|
||||||
selected=chanlist.size()-1;
|
actzap = updateSelection(chanlist.size()-1);
|
||||||
liststart = (selected/listmaxshow)*listmaxshow;
|
|
||||||
paint();
|
|
||||||
if(this->new_mode_active && SameTP()) {
|
|
||||||
actzap = true;
|
|
||||||
zapTo(selected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)
|
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)
|
||||||
{
|
{
|
||||||
int step = 0;
|
int step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1
|
||||||
int prev_selected = selected;
|
int new_selected = selected - step;
|
||||||
|
if (new_selected < 0) {
|
||||||
step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1
|
if (selected != 0 && step != 1)
|
||||||
selected -= step;
|
new_selected = 0;
|
||||||
if((prev_selected-step) < 0) {
|
|
||||||
if(prev_selected != 0 && step != 1)
|
|
||||||
selected = 0;
|
|
||||||
else
|
else
|
||||||
selected = chanlist.size() - 1;
|
new_selected = chanlist.size() - 1;
|
||||||
}
|
}
|
||||||
|
actzap = updateSelection(new_selected);
|
||||||
paintItem(prev_selected - liststart);
|
|
||||||
unsigned int oldliststart = liststart;
|
|
||||||
liststart = (selected/listmaxshow)*listmaxshow;
|
|
||||||
if(oldliststart!=liststart)
|
|
||||||
paint();
|
|
||||||
else {
|
|
||||||
paintItem(selected - liststart);
|
|
||||||
showChannelLogo();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this->new_mode_active && SameTP()) {
|
|
||||||
actzap = true;
|
|
||||||
zapTo(selected);
|
|
||||||
}
|
|
||||||
//paintHead();
|
|
||||||
}
|
}
|
||||||
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)
|
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)
|
||||||
{
|
{
|
||||||
unsigned int step = 0;
|
int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||||
unsigned int prev_selected = selected;
|
int new_selected = selected + step;
|
||||||
|
if (new_selected >= (int) chanlist.size()) {
|
||||||
step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1
|
if ((chanlist.size() - listmaxshow -1 < selected) && (selected != (chanlist.size() - 1)) && (step != 1))
|
||||||
selected += step;
|
new_selected = chanlist.size() - 1;
|
||||||
if(selected >= chanlist.size()) {
|
|
||||||
if((chanlist.size() - listmaxshow -1 < prev_selected) && (prev_selected != (chanlist.size() - 1)) && (step != 1))
|
|
||||||
selected = chanlist.size() - 1;
|
|
||||||
else if (((chanlist.size() / listmaxshow) + 1) * listmaxshow == chanlist.size() + listmaxshow) // last page has full entries
|
else if (((chanlist.size() / listmaxshow) + 1) * listmaxshow == chanlist.size() + listmaxshow) // last page has full entries
|
||||||
selected = 0;
|
new_selected = 0;
|
||||||
else
|
else
|
||||||
selected = ((step == listmaxshow) && (selected < (((chanlist.size() / listmaxshow)+1) * listmaxshow))) ? (chanlist.size() - 1) : 0;
|
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((chanlist.size() / listmaxshow)+1) * listmaxshow))) ? (chanlist.size() - 1) : 0;
|
||||||
}
|
}
|
||||||
|
actzap = updateSelection(new_selected);
|
||||||
paintItem(prev_selected - liststart);
|
|
||||||
unsigned int oldliststart = liststart;
|
|
||||||
liststart = (selected/listmaxshow)*listmaxshow;
|
|
||||||
if(oldliststart!=liststart)
|
|
||||||
paint();
|
|
||||||
else {
|
|
||||||
paintItem(selected - liststart);
|
|
||||||
showChannelLogo();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this->new_mode_active && SameTP()) {
|
|
||||||
actzap = true;
|
|
||||||
zapTo(selected);
|
|
||||||
}
|
|
||||||
//paintHead();
|
|
||||||
}
|
}
|
||||||
else if ((msg == (neutrino_msg_t)g_settings.key_bouquet_up) && (bouquetList != NULL)) {
|
else if ((msg == (neutrino_msg_t)g_settings.key_bouquet_up) && (bouquetList != NULL)) {
|
||||||
if (bouquetList->Bouquets.size() > 0) {
|
if (bouquetList->Bouquets.size() > 0) {
|
||||||
|
@@ -89,6 +89,7 @@ private:
|
|||||||
void clearItem2DetailsLine ();
|
void clearItem2DetailsLine ();
|
||||||
void paintItem2DetailsLine (int pos, int ch_index);
|
void paintItem2DetailsLine (int pos, int ch_index);
|
||||||
void paintItem(int pos);
|
void paintItem(int pos);
|
||||||
|
bool updateSelection(int newpos);
|
||||||
void paint();
|
void paint();
|
||||||
void paintHead();
|
void paintHead();
|
||||||
void paintButtonBar(bool is_current);
|
void paintButtonBar(bool is_current);
|
||||||
|
Reference in New Issue
Block a user