channellist: allow epgtext alignment

Origin commit data
------------------
Commit: 3a657e3960
Author: vanhofen <vanhofen@gmx.de>
Date: 2022-05-06 (Fri, 06 May 2022)

Origin message was:
------------------
- channellist: allow epgtext alignment
This commit is contained in:
vanhofen
2022-05-06 23:41:05 +02:00
parent 6371bd83ce
commit b170f4039d
11 changed files with 83 additions and 47 deletions

View File

@@ -2182,10 +2182,10 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
if (!p_event->description.empty())
{
if (g_settings.channellist_epgtext_align_right)
snprintf(chan_desc, sizeof(chan_desc), "%s", p_event->description.c_str());
else
if ((g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_LEFT_MIDDLE) || (g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_LEFT_BOTTOM))
snprintf(chan_desc, sizeof(chan_desc), " - %s", p_event->description.c_str());
else
snprintf(chan_desc, sizeof(chan_desc), "%s", p_event->description.c_str());
unsigned int chan_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(chan_desc);
@@ -2220,17 +2220,20 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
}
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, chan_name_len, chan_name, color);
int descr_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getDescender() - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getDescender();
if (g_settings.channellist_epgtext_align_right)
{
// align right
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - SCROLLBAR_WIDTH - offset_right - chan_desc_len, ypos + fheight - descr_offset, chan_desc_len, chan_desc, dcolor);
}
int chan_desc_x;
if ((g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_LEFT_MIDDLE) || (g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_LEFT_BOTTOM))
chan_desc_x = x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID + chan_name_len;
else
{
// align left
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID + chan_name_len, ypos + fheight - descr_offset, chan_desc_len, chan_desc, dcolor);
}
chan_desc_x = x + width - SCROLLBAR_WIDTH - offset_right - chan_desc_len;
int chan_desc_y_off;
if ((g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_LEFT_MIDDLE) || (g_settings.channellist_epgtext_alignment == EPGTEXT_ALIGN_RIGHT_MIDDLE))
chan_desc_y_off = fheight/2 - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight()/2;
else
chan_desc_y_off = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getDescender() - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getDescender();
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(chan_desc_x, ypos + fheight - chan_desc_y_off, chan_desc_len, chan_desc, dcolor);
}
else
{

View File

@@ -64,6 +64,13 @@ enum {
DISPLAY_MODE_MAX
};
enum {
EPGTEXT_ALIGN_LEFT_MIDDLE = 0,
EPGTEXT_ALIGN_LEFT_BOTTOM,
EPGTEXT_ALIGN_RIGHT_MIDDLE,
EPGTEXT_ALIGN_RIGHT_BOTTOM
};
enum {
CHANLIST_CANCEL = -1,
CHANLIST_CANCEL_ALL = -2,

View File

@@ -489,7 +489,7 @@ const CMenuOptionChooser::keyval VOLUMEBAR_DISP_POS_OPTIONS[VOLUMEBAR_DISP_POS_O
#define MENU_DISP_POS_OPTIONS_COUNT 5
const CMenuOptionChooser::keyval MENU_DISP_POS_OPTIONS[MENU_DISP_POS_OPTIONS_COUNT]=
{
{ 0, LOCALE_SETTINGS_POS_DEFAULT_CENTER },
{ 0, LOCALE_SETTINGS_POS_CENTER },
{ 1, LOCALE_SETTINGS_POS_TOP_LEFT },
{ 2, LOCALE_SETTINGS_POS_TOP_RIGHT },
{ 3, LOCALE_SETTINGS_POS_BOTTOM_LEFT },
@@ -520,11 +520,13 @@ const CMenuOptionChooser::keyval CHANNELLIST_FOOT_OPTIONS[CHANNELLIST_FOOT_OPTIO
{ 2, LOCALE_CHANNELLIST_FOOT_OFF }
};
#define CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT 2
const CMenuOptionChooser::keyval CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS[CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT]=
#define CHANNELLIST_EPGTEXT_ALIGNMENT_OPTIONS_COUNT 4
const CMenuOptionChooser::keyval CHANNELLIST_EPGTEXT_ALIGNMENT_OPTIONS[CHANNELLIST_EPGTEXT_ALIGNMENT_OPTIONS_COUNT]=
{
{ 0, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_LEFT },
{ 1, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_RIGHT }
{ EPGTEXT_ALIGN_LEFT_MIDDLE, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_LEFT_MIDDLE },
{ EPGTEXT_ALIGN_LEFT_BOTTOM, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_LEFT_BOTTOM },
{ EPGTEXT_ALIGN_RIGHT_MIDDLE, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_RIGHT_MIDDLE },
{ EPGTEXT_ALIGN_RIGHT_BOTTOM, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_RIGHT_BOTTOM }
};
#define OPTIONS_COLORED_EVENTS_OPTION_COUNT 3
@@ -575,10 +577,10 @@ const CMenuOptionChooser::keyval PROGRESSBAR_COLOR_OPTIONS[PROGRESSBAR_COLOR_OPT
#define OPTIONS_CHANNELLOGO_POSITION_COUNT 4
const CMenuOptionChooser::keyval OPTIONS_CHANNELLOGO_POSITION[OPTIONS_CHANNELLOGO_POSITION_COUNT] =
{
{ 0, LOCALE_OPTIONS_OFF }, // off
{ CCHeaderTypes::CC_LOGO_RIGHT, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_RIGHT }, // right
{ CCHeaderTypes::CC_LOGO_LEFT, LOCALE_CHANNELLIST_EPGTEXT_ALIGN_LEFT }, // left
{ CCHeaderTypes::CC_LOGO_CENTER, LOCALE_SETTINGS_POS_DEFAULT_CENTER } // centered
{ 0, LOCALE_OPTIONS_OFF }, // off
{ CCHeaderTypes::CC_LOGO_RIGHT, LOCALE_SETTINGS_POS_RIGHT }, // right
{ CCHeaderTypes::CC_LOGO_LEFT, LOCALE_SETTINGS_POS_LEFT }, // left
{ CCHeaderTypes::CC_LOGO_CENTER, LOCALE_SETTINGS_POS_CENTER } // centered
};
// show osd setup
@@ -1410,7 +1412,7 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist)
menu_chanlist->addItem(mc);
// epg align
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_EPGTEXT_ALIGN, &g_settings.channellist_epgtext_align_right, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT, true);
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_EPGTEXT_ALIGNMENT, &g_settings.channellist_epgtext_alignment, CHANNELLIST_EPGTEXT_ALIGNMENT_OPTIONS, CHANNELLIST_EPGTEXT_ALIGNMENT_OPTIONS_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EPG_ALIGN);
menu_chanlist->addItem(mc);