Skip to content

Commit

Permalink
channellist: use hotkey icons in history mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhofen authored and BPanther committed Jun 30, 2023
1 parent cc81836 commit 737be65
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/gui/channellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2030,8 +2030,6 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
title_offset = OFFSET_INNER_MID;
}

snprintf(tmp, sizeof(tmp), "%d", this->historyMode ? pos : chan->number);

CChannelEvent *p_event=NULL;
if (displayMode == DISPLAY_MODE_NOW)
p_event = &chan->currentEvent;
Expand Down Expand Up @@ -2130,6 +2128,8 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
if (paintbuttons)
paintButtonBar(is_available);

snprintf(tmp, sizeof(tmp), "%d", chan->number);

//channel numbers
if (curr == selected && move_state == beMoving)
{
Expand All @@ -2143,8 +2143,26 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
}
else if (g_settings.channellist_show_numbers)
{
int numpos = x + OFFSET_INNER_MID + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + fheight, numwidth + 5, tmp, color, fheight);
if (this->historyMode)
{
// history mode only uses digits 0..9 as hotkeys
if (pos >= 0 && pos <= 9)
{
std::string h = to_string(pos);
//frameBuffer->getIconSize(h.c_str(), &icon_w, &icon_h);
frameBuffer->paintIcon(h.c_str(), x + OFFSET_INNER_MID /*+ numwidth - icon_w*/, ypos, fheight);
}
else
{
//frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, x + OFFSET_INNER_MID /*+ numwidth - icon_w*/, ypos, fheight);
}
}
else
{
int numpos = x + OFFSET_INNER_MID + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + fheight, numwidth + 5, tmp, color, fheight);
}
}
else if (!edit_state)
{
Expand Down Expand Up @@ -2375,6 +2393,13 @@ void CChannelList::paintBody()
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icon_w, &icon_h);
numwidth = std::max(icon_w, (int) numwidth);

if (this->historyMode)
{
// we assume NEUTRINO_ICON_BUTTON_DUMMY_SMALL has the same size as NEUTRINO_ICON_BUTTON_0..9
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, &icon_w, &icon_h);
numwidth = icon_w;
}

liststart = (selected/listmaxshow)*listmaxshow;
updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow));

Expand Down

0 comments on commit 737be65

Please sign in to comment.