diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-03-11 13:29:06 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-03-11 13:29:06 +0100 |
commit | c174dc0f5bd839d96e0e3d43de3e26d49c87a235 (patch) | |
tree | c315b1781fd622ed23d664a80244e36fe11206de /channels.c | |
parent | 2be049f5f7951be9152531a46849712a147f68d6 (diff) | |
download | vdr-c174dc0f5bd839d96e0e3d43de3e26d49c87a235.tar.gz vdr-c174dc0f5bd839d96e0e3d43de3e26d49c87a235.tar.bz2 |
The channel name column in the "What's on now/next" menu now adjusts its width to display the full short name of each channel
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 2.20 2012/03/07 16:50:15 kls Exp $ + * $Id: channels.c 2.21 2012/03/11 13:29:06 kls Exp $ */ #include "channels.h" @@ -760,6 +760,8 @@ cChannels Channels; cChannels::cChannels(void) { maxNumber = 0; + maxChannelNameLength = 0; + maxShortChannelNameLength = 0; modified = CHANNELSMOD_NONE; } @@ -937,9 +939,32 @@ bool cChannels::SwitchTo(int Number) return channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true); } +int cChannels::MaxChannelNameLength(void) +{ + if (!maxChannelNameLength) { + for (cChannel *channel = First(); channel; channel = Next(channel)) { + if (!channel->GroupSep()) + maxChannelNameLength = max(Utf8StrLen(channel->Name()), maxChannelNameLength); + } + } + return maxChannelNameLength; +} + +int cChannels::MaxShortChannelNameLength(void) +{ + if (!maxShortChannelNameLength) { + for (cChannel *channel = First(); channel; channel = Next(channel)) { + if (!channel->GroupSep()) + maxShortChannelNameLength = max(Utf8StrLen(channel->ShortName()), maxShortChannelNameLength); + } + } + return maxShortChannelNameLength; +} + void cChannels::SetModified(bool ByUser) { modified = ByUser ? CHANNELSMOD_USER : !modified ? CHANNELSMOD_AUTO : modified; + maxChannelNameLength = maxShortChannelNameLength = 0; } int cChannels::Modified(void) |