osd_setup: auto-calc size of font_size structs

Origin commit data
------------------
Branch: ni/coolstream
Commit: 74345ecaa2
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-15 (Mon, 15 Aug 2016)

Origin message was:
------------------
- osd_setup: auto-calc size of font_size structs

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-08-15 22:14:31 +02:00
parent b7153c49c8
commit 4130ca1100

View File

@@ -100,7 +100,7 @@ COsdSetup::~COsdSetup()
} }
//font settings //font settings
const SNeutrinoSettings::FONT_TYPES channellist_font_sizes[5] = const SNeutrinoSettings::FONT_TYPES channellist_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_CHANNELLIST, SNeutrinoSettings::FONT_TYPE_CHANNELLIST,
SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR, SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR,
@@ -108,8 +108,9 @@ const SNeutrinoSettings::FONT_TYPES channellist_font_sizes[5] =
SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT, SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT,
SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP
}; };
size_t channellist_font_items = sizeof(channellist_font_sizes)/sizeof(channellist_font_sizes[0]);
const SNeutrinoSettings::FONT_TYPES eventlist_font_sizes[5] = const SNeutrinoSettings::FONT_TYPES eventlist_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE, SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE,
SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE, SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE,
@@ -117,24 +118,27 @@ const SNeutrinoSettings::FONT_TYPES eventlist_font_sizes[5] =
SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME, SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME,
SNeutrinoSettings::FONT_TYPE_EVENTLIST_EVENT SNeutrinoSettings::FONT_TYPE_EVENTLIST_EVENT
}; };
size_t eventlist_font_items = sizeof(eventlist_font_sizes)/sizeof(eventlist_font_sizes[0]);
const SNeutrinoSettings::FONT_TYPES infobar_font_sizes[4] = const SNeutrinoSettings::FONT_TYPES infobar_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER, SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER,
SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME, SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME,
SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO, SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO,
SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL
}; };
size_t infobar_font_items = sizeof(infobar_font_sizes)/sizeof(infobar_font_sizes[0]);
const SNeutrinoSettings::FONT_TYPES epg_font_sizes[4] = const SNeutrinoSettings::FONT_TYPES epg_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_EPG_TITLE, SNeutrinoSettings::FONT_TYPE_EPG_TITLE,
SNeutrinoSettings::FONT_TYPE_EPG_INFO1, SNeutrinoSettings::FONT_TYPE_EPG_INFO1,
SNeutrinoSettings::FONT_TYPE_EPG_INFO2, SNeutrinoSettings::FONT_TYPE_EPG_INFO2,
SNeutrinoSettings::FONT_TYPE_EPG_DATE SNeutrinoSettings::FONT_TYPE_EPG_DATE
}; };
size_t epg_font_items = sizeof(epg_font_sizes)/sizeof(epg_font_sizes[0]);
const SNeutrinoSettings::FONT_TYPES menu_font_sizes[5] = const SNeutrinoSettings::FONT_TYPES menu_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_MENU_TITLE, SNeutrinoSettings::FONT_TYPE_MENU_TITLE,
SNeutrinoSettings::FONT_TYPE_MENU, SNeutrinoSettings::FONT_TYPE_MENU,
@@ -142,22 +146,25 @@ const SNeutrinoSettings::FONT_TYPES menu_font_sizes[5] =
SNeutrinoSettings::FONT_TYPE_MENU_FOOT, SNeutrinoSettings::FONT_TYPE_MENU_FOOT,
SNeutrinoSettings::FONT_TYPE_MENU_HINT SNeutrinoSettings::FONT_TYPE_MENU_HINT
}; };
const SNeutrinoSettings::FONT_TYPES other_font_sizes[2] = size_t menu_font_items = sizeof(menu_font_sizes)/sizeof(menu_font_sizes[0]);
const SNeutrinoSettings::FONT_TYPES other_font_sizes[] =
{ {
SNeutrinoSettings::FONT_TYPE_SUBTITLES, SNeutrinoSettings::FONT_TYPE_SUBTITLES,
SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM
}; };
size_t other_font_items = sizeof(other_font_sizes)/sizeof(other_font_sizes[0]);
#define FONT_GROUP_COUNT 6 font_sizes_groups font_sizes_groups[] =
font_sizes_groups font_sizes_groups[FONT_GROUP_COUNT] =
{ {
{LOCALE_FONTMENU_MENU , 5, menu_font_sizes , "fontsize.dmen", LOCALE_MENU_HINT_MENU_FONTS }, {LOCALE_FONTMENU_MENU , menu_font_items , menu_font_sizes , "fontsize.dmen", LOCALE_MENU_HINT_MENU_FONTS },
{LOCALE_FONTMENU_CHANNELLIST, 5, channellist_font_sizes, "fontsize.dcha", LOCALE_MENU_HINT_CHANNELLIST_FONTS }, {LOCALE_FONTMENU_CHANNELLIST, channellist_font_items, channellist_font_sizes, "fontsize.dcha", LOCALE_MENU_HINT_CHANNELLIST_FONTS },
{LOCALE_FONTMENU_EVENTLIST , 5, eventlist_font_sizes , "fontsize.deve", LOCALE_MENU_HINT_EVENTLIST_FONTS }, {LOCALE_FONTMENU_EVENTLIST , eventlist_font_items , eventlist_font_sizes , "fontsize.deve", LOCALE_MENU_HINT_EVENTLIST_FONTS },
{LOCALE_FONTMENU_EPG , 4, epg_font_sizes , "fontsize.depg", LOCALE_MENU_HINT_EPG_FONTS }, {LOCALE_FONTMENU_EPG , epg_font_items , epg_font_sizes , "fontsize.depg", LOCALE_MENU_HINT_EPG_FONTS },
{LOCALE_FONTMENU_INFOBAR , 4, infobar_font_sizes , "fontsize.dinf", LOCALE_MENU_HINT_INFOBAR_FONTS }, {LOCALE_FONTMENU_INFOBAR , infobar_font_items , infobar_font_sizes , "fontsize.dinf", LOCALE_MENU_HINT_INFOBAR_FONTS },
{LOCALE_FONTMENU_OTHER , 2, other_font_sizes , "fontsize.doth", LOCALE_MENU_HINT_OTHER_FONTS } {LOCALE_FONTMENU_OTHER , other_font_items , other_font_sizes , "fontsize.doth", LOCALE_MENU_HINT_OTHER_FONTS }
}; };
#define FONT_GROUP_COUNT (sizeof(font_sizes_groups)/sizeof(font_sizes_groups[0]))
font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] =
{ {
@@ -337,7 +344,7 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
return res; return res;
} }
else if(strncmp(actionKey.c_str(), "fontsize.d", 10) == 0) { else if(strncmp(actionKey.c_str(), "fontsize.d", 10) == 0) {
for (int i = 0; i < FONT_GROUP_COUNT; i++) { for (unsigned int i = 0; i < FONT_GROUP_COUNT; i++) {
if (actionKey == font_sizes_groups[i].actionkey) { if (actionKey == font_sizes_groups[i].actionkey) {
for (unsigned int j = 0; j < font_sizes_groups[i].count; j++) { for (unsigned int j = 0; j < font_sizes_groups[i].count; j++) {
SNeutrinoSettings::FONT_TYPES k = font_sizes_groups[i].content[j]; SNeutrinoSettings::FONT_TYPES k = font_sizes_groups[i].content[j];
@@ -954,7 +961,7 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
//fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font")); //fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font"));
mn_widget_id_t w_index = MN_WIDGET_ID_OSDSETUP_FONTSIZE_MENU; mn_widget_id_t w_index = MN_WIDGET_ID_OSDSETUP_FONTSIZE_MENU;
for (int i = 0; i < FONT_GROUP_COUNT; i++) for (unsigned int i = 0; i < FONT_GROUP_COUNT; i++)
{ {
CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, w_index); CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, w_index);