From e1f887af7252e45f151cdc1a9944b49f0a8de37c Mon Sep 17 00:00:00 2001 From: thilo Date: Mon, 21 Feb 2011 09:08:10 +0000 Subject: [PATCH] *neutrino buttonbars: reworked painting of buttonbar in channellist, stringinput (also cleared some char format problems), audioplayer, bouqueteditor_bouqets, bouqueteditor_channels, bouqueteditor_chanselect, bookmarkmanager,, bouquetlist, filebrowser, epgplus, epgview, pictureviewer, timerlist, upnpbrowser TODO: This is still not a final solution. I would like to see buttonhandling in own class for better integration and handling of window structure. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1179 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/audioplayer.cpp | 52 ++----- src/gui/bedit/bouqueteditor_bouquets.cpp | 11 +- src/gui/bedit/bouqueteditor_channels.cpp | 14 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 7 +- src/gui/bookmarkmanager.cpp | 12 +- src/gui/bookmarkmanager.h | 8 +- src/gui/bouquetlist.cpp | 18 +-- src/gui/bouquetlist.h | 2 +- src/gui/channellist.cpp | 22 ++- src/gui/channellist.h | 2 +- src/gui/epgplus.cpp | 16 +- src/gui/epgview.cpp | 9 +- src/gui/filebrowser.cpp | 35 ++--- src/gui/pictureviewer.cpp | 23 +-- src/gui/timerlist.cpp | 26 +--- src/gui/upnpbrowser.cpp | 96 ++++++------ src/gui/widget/buttons.cpp | 173 ++++++++++++++++++--- src/gui/widget/buttons.h | 21 ++- src/gui/widget/stringinput.cpp | 38 ++--- src/gui/widget/stringinput.h | 1 + 20 files changed, 317 insertions(+), 269 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 7eb9fc06d..eed7fce8b 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1703,71 +1703,51 @@ const struct button_label ScondLineButtons[2] = else top = m_y + (m_height - 2 * m_buttonHeight); - int ButtonWidth = (m_width - 20) / 4; + int ButtonWidth = (m_width - 20) / 5; //int ButtonWidth2 = (m_width - 50) / 2; m_frameBuffer->paintBoxRel(m_x, top, m_width, 2 * m_buttonHeight, COL_INFOBAR_SHADOW_PLUS_1, c_rad_mid, CORNER_BOTTOM); m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1); if (!m_playlist.empty()) - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, m_x + 10, top+m_buttonHeight, ButtonWidth, 2, ScondLineButtons); + ::paintButtons(m_x, top+m_buttonHeight, m_width, 2, ScondLineButtons, m_buttonHeight, ButtonWidth); - } if (m_key_level == 0) { - if (m_playlist.empty()) { + if (m_playlist.empty()) + { if (m_inetmode) - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[7]); + ::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[7], m_buttonHeight, ButtonWidth); else - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 1, &(AudioPlayerButtons[7][0])); - } else if (m_inetmode) - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[8]); + ::paintButtons(m_x, top, m_width, 1, &(AudioPlayerButtons[7][0]), m_buttonHeight, ButtonWidth); + } + else if (m_inetmode) + ::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[8], m_buttonHeight, ButtonWidth); else - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[1]); + ::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[1], m_buttonHeight, ButtonWidth); } else if (m_key_level == 1) { if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO) - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[0]); - } + ::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[0], m_buttonHeight, ButtonWidth); else - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, m_x + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[6]); - } + ::paintButtons( m_x, top, m_width, 2, AudioPlayerButtons[6], m_buttonHeight, ButtonWidth); } else { // key_level == 2 if (m_state == CAudioPlayerGui::STOP) { if (m_select_title_by_name) - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[5]); - } + ::paintButtons(m_x /*+ ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[5], m_buttonHeight, ButtonWidth); else - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[4]); - } + ::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[4], m_buttonHeight, ButtonWidth); } else { if (m_select_title_by_name) - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[3]); - } + ::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[3], m_buttonHeight, ButtonWidth); else - { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[2]); - } + ::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[2], m_buttonHeight, ButtonWidth); } } } diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index e17f2b5c3..065e55112 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -57,7 +57,7 @@ CBEBouquetWidget::CBEBouquetWidget() frameBuffer = CFrameBuffer::getInstance(); iconoffset = 0; - ButtonHeight = 25; + ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); @@ -163,11 +163,11 @@ void CBEBouquetWidget::paintFoot() fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - ButtonHeight = std::max(fh, icol_h+4); +/* ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8*//*std::max(fh, icol_h+4)*/; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_DBOX, &icol_w, &h2); - ButtonHeight = std::max(ButtonHeight, h2+4); +// ButtonHeight = std::max(ButtonHeight, h2+4); - frameBuffer->paintBoxRel(x,y+height, width,ButtonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); +// frameBuffer->paintBoxRel(x,y+height, width,ButtonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //frameBuffer->paintHLine(x, x+width, y, COL_INFOBAR_SHADOW_PLUS_0); switch( blueFunction) @@ -182,8 +182,7 @@ void CBEBouquetWidget::paintFoot() Button[3].locale = LOCALE_BOUQUETEDITOR_LOCK; break; } - //::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 5, y + height + 4, (width - 28 - 10) / 4, 4, Button); - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height, (width - icol_w - 20) / 4, ButtonHeight, 4, Button); + ::paintButtons(x, y+height, width, 4, Button, ButtonHeight); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, x + width - 10 - icol_w, y + height, ButtonHeight); } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index a0dd32c38..5e4bdbec0 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -57,7 +57,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou int icol_w, icol_h; frameBuffer = CFrameBuffer::getInstance(); selected = 0; - ButtonHeight = 25; + ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; iconoffset = 0; theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -153,17 +153,7 @@ const struct button_label CBEChannelWidgetButtons[4] = void CBEChannelWidget::paintFoot() { - int icol_w, icol_h, fh; - - fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - ButtonHeight = std::max(fh, icol_h+4); - - frameBuffer->paintBoxRel(x,y+height, width,ButtonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - //frameBuffer->paintHLine(x, x+width, y, COL_INFOBAR_SHADOW_PLUS_0); - - //::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height + 4, (width - 20) / 4, 4, CBEChannelWidgetButtons); - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height, (width - 20) / 4, ButtonHeight, 4, CBEChannelWidgetButtons); + ::paintButtons(x, y+height, width, 4, CBEChannelWidgetButtons, ButtonHeight); } void CBEChannelWidget::hide() diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index da16ec279..1fb0a9ab0 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -184,11 +184,8 @@ const struct button_label CBEChannelSelectButtons[] = void CBEChannelSelectWidget::paintFoot() { - int ButtonWidth = (width - 20) / 2; - frameBuffer->paintBoxRel(x, y+height, width, ButtonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - //frameBuffer->paintHLine(x, x+width, y, COL_INFOBAR_SHADOW_PLUS_0); - - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height, ButtonWidth, ButtonHeight, 2, CBEChannelSelectButtons); + int ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; + ::paintButtons(x, y+height, width, 2, CBEChannelSelectButtons, ButtonHeight); #if 0 frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 3* ButtonWidth+ 8, y+height+1); diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 5a6ea7aac..6b076d86c 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -227,8 +227,8 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) visible = false; selected = 0; // Max - width = w_max( 720, 10 ); - buttonHeight = 25; + width = w_max( 90, 10 ); + footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //initial height value for buttonbar theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); x=getScreenStartX( width ); @@ -438,19 +438,19 @@ const struct button_label BookmarkmanagerButtons[2] = void CBookmarkManager::paintFoot() { int ButtonWidth = (width - 20) / 4; - frameBuffer->paintBoxRel(x,y+height, width,buttonHeight, COL_MENUHEAD_PLUS_0); + frameBuffer->paintBoxRel(x,y+height, width, footerHeight, COL_INFOBAR_SHADOW_PLUS_1); frameBuffer->paintHLine(x, x+width, y, COL_INFOBAR_SHADOW_PLUS_0); if (bookmarks.empty()) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, y+height+24 - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, y+height+footerHeight - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR, 0, true); // UTF-8 } else { - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height + 4, ButtonWidth, 2, BookmarkmanagerButtons); + ::paintButtons(x + 10, y + height + 4, width, 2, BookmarkmanagerButtons, footerHeight, ButtonWidth); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, y+height+24 - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, y+height+footerHeight - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR, 0, true); // UTF-8 } } diff --git a/src/gui/bookmarkmanager.h b/src/gui/bookmarkmanager.h index 6f9486ec2..e1f88e02a 100644 --- a/src/gui/bookmarkmanager.h +++ b/src/gui/bookmarkmanager.h @@ -73,10 +73,10 @@ class CBookmarkManager unsigned int selected; unsigned int liststart; unsigned int listmaxshow; - int fheight; // Fonthoehe Timerlist-Inhalt - int theight; // Fonthoehe Timerlist-Titel - int buttonHeight; - bool visible; + int fheight; // Fonthoehe Timerlist-Inhalt + int theight; // Fonthoehe Timerlist-Titel + int footerHeight; + bool visible; int width; int height; int x; diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 6a62310c6..536053966 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -302,11 +302,10 @@ int CBouquetList::show(bool bShowChannelList) int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - //buttonHeight = 7 + std::max(icol_h+2, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()); - buttonHeight = std::max(icol_h+4, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()); + footerHeight = std::max(icol_h+8, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8); //TODO get footerHeight from buttons theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - listmaxshow = (height - theight - buttonHeight)/fheight; - height = theight + buttonHeight + listmaxshow * fheight; // recalc height + listmaxshow = (height - theight - footerHeight)/fheight; + height = theight + footerHeight + listmaxshow * fheight; // recalc height x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; @@ -616,16 +615,9 @@ void CBouquetList::paint() else // if(lastnum<100000) numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00000"); - //frameBuffer->paintBoxRel(x, y+theight, width, height-theight+10, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - frameBuffer->paintBoxRel(x, y+theight, width, height - theight - buttonHeight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, y+theight, width, height - theight - footerHeight, COL_MENUCONTENT_PLUS_0); - int ButtonWidth = (width - 20) / 4; - - frameBuffer->paintBoxRel(x, y + (height - buttonHeight), width, buttonHeight - 1, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, - /*y + (height - buttonHeight) + 3, ButtonWidth, */ - y + (height - buttonHeight), ButtonWidth, buttonHeight, - sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]), CBouquetListButtons); + ::paintButtons(x, y + (height - footerHeight), width, sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]), CBouquetListButtons, footerHeight); if(Bouquets.size()) { diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index 748aff917..35dcb136f 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -87,7 +87,7 @@ class CBouquetList unsigned int maxpos; int fheight; // Fonthoehe Bouquetlist-Inhalt int theight; // Fonthoehe Bouquetlist-Titel - int buttonHeight; + int footerHeight; int width; int height; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 2fa5fdb6e..193be5ca0 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -105,6 +105,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl vlist = _vlist; selected_chid = 0; this->new_mode_active = false; + footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar //printf("************ NEW LIST %s : %x\n", name.c_str(), this);fflush(stdout); } @@ -478,8 +479,6 @@ int CChannelList::show() /* assuming all color icons must have same size */ int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - //buttonHeight = 7 + std::max(icol_h+2, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()); - buttonHeight = std::max(icol_h+4, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -498,8 +497,8 @@ int CChannelList::show() if (fheight == 0) fheight = 1; /* avoid crash on invalid font */ - listmaxshow = (height - theight - buttonHeight -0)/fheight; - height = theight + buttonHeight + listmaxshow * fheight; + listmaxshow = (height - theight - footerHeight -0)/fheight; + height = theight + footerHeight + listmaxshow * fheight; info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; @@ -1833,19 +1832,16 @@ void CChannelList::paintHead() logo_off = timestr_len + 4; g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10,y+theight+0, width - timestr_len, name, COL_MENUHEAD, 0, true); // UTF-8 - // foot - int ButtonWidth = (width - 20) / NUM_LIST_BUTTONS; - + //foot/buttonbar + if (displayNext) { CChannelListButtons[1].locale = LOCALE_INFOVIEWER_NOW; } else { CChannelListButtons[1].locale = LOCALE_INFOVIEWER_NEXT; } - - frameBuffer->paintBoxRel(x, y + (height - buttonHeight), width, buttonHeight - 1, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //round - //::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + (height - buttonHeight) + 3, ButtonWidth, - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + (height - buttonHeight), ButtonWidth, buttonHeight, - NUM_LIST_BUTTONS, CChannelListButtons); + + int y_foot = y + (height - footerHeight); + ::paintButtons(x, y_foot, width, NUM_LIST_BUTTONS, CChannelListButtons, footerHeight/*, (width - 20) / NUM_LIST_BUTTONS*/); //buttonwidth will set automaticly } void CChannelList::paint() @@ -1856,7 +1852,7 @@ void CChannelList::paint() updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow)); - frameBuffer->paintBoxRel(x, y+theight, width, height-buttonHeight-theight, COL_MENUCONTENT_PLUS_0, 0, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, y+theight, width, height-footerHeight-theight, COL_MENUCONTENT_PLUS_0, 0, CORNER_BOTTOM); for(unsigned int count = 0; count < listmaxshow; count++) { paintItem(count); } diff --git a/src/gui/channellist.h b/src/gui/channellist.h index bc50069be..c6caf929a 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -63,7 +63,7 @@ class CChannelList unsigned int numwidth; int fheight; // Fonthoehe Channellist-Inhalt int theight; // Fonthoehe Channellist-Titel - int buttonHeight; + int footerHeight; std::string name; ZapitChannelList chanlist; diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index c6e704334..73922b654 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -133,7 +133,7 @@ void EpgPlus::Header::paint(const char * Name) int EpgPlus::Header::getUsedHeight() { - return font->getHeight() + 4 ; + return font->getHeight() + 8 ; } Font *EpgPlus::TimeLine::fontTime = NULL; @@ -434,7 +434,7 @@ EpgPlus::Footer::Footer (CFrameBuffer * pframeBuffer, int px, int py, int pwidth this->x = px; this->y = py; this->width = pwidth; - this->buttonHeight = height; + this->buttonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //TODO get height from buttons } EpgPlus::Footer::~Footer() @@ -505,14 +505,9 @@ struct button_label buttonLabels[] = { void EpgPlus::Footer::paintButtons (button_label * pbuttonLabels, int numberOfButtons) { - int buttonWidth = (this->width - RADIUS_LARGE) / 4; + int buttonWidth = (this->width); int yPos = this->y + this->getUsedHeight(); - - this->frameBuffer->paintBoxRel (this->x, yPos, this->width, buttonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - - ::paintButtons (this->frameBuffer, this->fontButtons, g_Locale, this->x + 10, - yPos, buttonWidth, buttonHeight, numberOfButtons, pbuttonLabels); - + ::paintButtons (this->x, yPos, buttonWidth, numberOfButtons, pbuttonLabels, buttonHeight); } EpgPlus::EpgPlus() @@ -703,8 +698,7 @@ void EpgPlus::init() if(icol_h < h2) icol_h = h2; - //int buttonHeight = 6 + std::max (icol_h+2, fonts[EPGPlus_footer_fontbuttons]->getHeight()); - int buttonHeight = std::max (icol_h+4, fonts[EPGPlus_footer_fontbuttons]->getHeight()); + int buttonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //TODO get height from buttons/*std::max (icol_h+8, fonts[EPGPlus_footer_fontbuttons]->getHeight());*/ int footerHeight = Footer::getUsedHeight() + buttonHeight; this->maxNumberOfDisplayableEntries = (this->usableScreenHeight - headerHeight - timeLineHeight - horGap1Height - horGap2Height - footerHeight) / this->entryHeight; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index c8aae52a9..a758b2633 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1133,7 +1133,6 @@ void CEpgData::showTimerEventBar (bool pshow) w = ox - 20; x = sx + 10; y = sy + oy; - cellwidth = w / 4; fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); @@ -1145,14 +1144,12 @@ void CEpgData::showTimerEventBar (bool pshow) if (! pshow) return; - frameBuffer->paintBoxRel(sx,y,ox,h, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);//round + frameBuffer->paintBoxRel(sx,y,ox,h, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM);//round if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x, y, cellwidth*2, h, 2, EpgButtons); + ::paintButtons(x, y, 0, 2, EpgButtons, h); else - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x + cellwidth*2, y, cellwidth, h, 1, &EpgButtons[1]); + ::paintButtons(x, y, 0, 1, &EpgButtons[1], h); #if 0 // Button: Timer Record & Channelswitch diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index d781577ba..1dd268135 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -390,7 +390,7 @@ void CFileBrowser::commonInit() fheight = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight(); if (fheight == 0) fheight = 1; /* avoid div by zero on invalid font */ - foheight = 30; + foheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar; TODO get value from buttonbar liststart = 0; listmaxshow = std::max(1,(int)(height - theight - 2 * foheight)/fheight); @@ -1433,38 +1433,37 @@ void CFileBrowser::paintFoot() { NEUTRINO_ICON_BUTTON_MUTE_SMALL, LOCALE_FILEBROWSER_DELETE }, }; - int dx = (width-20) / 4; - //Second Line (bottom, top) - int by2 = y + height - (foheight - 4); - int iw = 0, ih = 0; - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &iw, &ih); + int dx = (width-20) / 4; +// int iw = 0, ih = 0; +// frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &iw, &ih); //Background - frameBuffer->paintBoxRel(x, y + height - (2 * foheight ), width, (2 * foheight ), COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); + int by0 = y + height - (2 * foheight ); + frameBuffer->paintBoxRel(x, by0, width, (2 * foheight ), COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); + + //Second Line (bottom, top) + int by2 = by0 + foheight; if (!(filelist.empty())) { - int by = y + height - 2 * (foheight - 4); - - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, by, dx, Multi_Select ? 3 : 2, FileBrowserButtons); + //red, green, yellow button + ::paintButtons(x, by0, 0, Multi_Select ? 3 : 2, FileBrowserButtons, foheight); + //blue filter if(Filter != NULL) - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10 + (3 * dx), by, dx, 1, &(FileBrowserFilterButton[use_filter?0:1])); + ::paintButtons(x + 10 + (3 * dx), by0, 0, 1, &(FileBrowserFilterButton[use_filter?0:1]), foheight); //OK-Button if( (filelist[selected].getType() != CFile::FILE_UNKNOWN) || (S_ISDIR(filelist[selected].Mode)) ) - { - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10 , by2, dx, 1,&(FileBrowserButtons2[0])); + ::paintButtons(x, by2, 0, 1,&(FileBrowserButtons2[0]), foheight); - } - - //?-Button - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10 + dx , by2, dx, 1,&(FileBrowserButtons2[1])); + //help-Button + ::paintButtons(x + 10 + dx , by2, 0, 1,&(FileBrowserButtons2[1]), foheight); //Mute-Button if (strncmp(Path.c_str(), VLC_URI, strlen(VLC_URI)) != 0) { //Not in vlc mode - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10 + (dx * 2) , by2, dx, 1,&(FileBrowserButtons2[2])); + ::paintButtons(x + 10 + (dx * 2) , by2, 0, 1,&(FileBrowserButtons2[2])); } diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index fb7bf1417..6b2b38d3c 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -133,7 +133,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey theight = std::max(theight, icol_h); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - buttonHeight = 8 + std::max(icol_h+2, sheight); + buttonHeight = 8 + std::max(icol_h+2, sheight); //TODO get value from buttonbar fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); listmaxshow = (height-theight-2*buttonHeight)/(fheight); @@ -648,30 +648,17 @@ const struct button_label PictureViewerButtons2[][2] = void CPictureViewerGui::paintFoot() { // printf("paintFoot{\n"); - int ButtonWidth = (width-20) / 4; -// int ButtonWidth2 = (width-50) / 2; - frameBuffer->paintBoxRel(x, y+(height-2*buttonHeight), width, 2*buttonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - frameBuffer->paintHLine(x, x+width, y+(height-2*buttonHeight), COL_INFOBAR_SHADOW_PLUS_0); + frameBuffer->paintBoxRel(x, y+(height-2*buttonHeight), width, 2*buttonHeight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); if (!playlist.empty()) { - //::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + (height - 2 * buttonHeight) + 4, ButtonWidth, 4, PictureViewerButtons); - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x + 10, y + (height - 2 * buttonHeight), ButtonWidth, buttonHeight, - 4, PictureViewerButtons); - - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x + 10, y + (height - buttonHeight), ButtonWidth*2, buttonHeight, - 2, (m_sort==FILENAME)?PictureViewerButtons2[0]:PictureViewerButtons2[1]); - + ::paintButtons(x, y + (height - 2 * buttonHeight), 0, 4, PictureViewerButtons); + ::paintButtons(x, y + (height - buttonHeight), 0, 2, (m_sort==FILENAME)?PictureViewerButtons2[0]:PictureViewerButtons2[1]); } else - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - /*x + ButtonWidth + 10, y + (height - 2 * buttonHeight) + 4, ButtonWidth,*/ - x + ButtonWidth + 10, y + (height - 2 * buttonHeight), ButtonWidth, buttonHeight, - 1, &(PictureViewerButtons[1])); + ::paintButtons(x , y + (height - 2 * buttonHeight), 0, 1, &(PictureViewerButtons[1])); // printf("paintFoot}\n"); } //------------------------------------------------------------------------ diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index f46778b7e..9327d92b4 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -826,32 +826,22 @@ void CTimerList::paintHead() frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x + width - icol_w - 10, y, theight); } -const struct button_label TimerListButtons[3] = +const struct button_label TimerListButtons[4] = { - { NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE }, - { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW }, - { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_TIMERLIST_RELOAD } + { NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE }, + { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW }, + { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, + { NEUTRINO_ICON_BUTTON_OKAY , LOCALE_TIMERLIST_MODIFY } }; void CTimerList::paintFoot() { - int ButtonWidth = (width - 20) / 4; - frameBuffer->paintBoxRel(x, y+height, width, buttonHeight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - //frameBuffer->paintHLine(x, x+width, y, COL_INFOBAR_SHADOW_PLUS_0); if (timerlist.empty()) - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x + ButtonWidth + 10, y + height, ButtonWidth, buttonHeight, 2, &(TimerListButtons[1])); + ::paintButtons( x, y + height, width, 2, &(TimerListButtons[1])); else - { - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - x + 10, y + height, ButtonWidth, buttonHeight, 3, TimerListButtons); - - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height, buttonHeight); - int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, - y + height + fh + (buttonHeight - fh)/2 , ButtonWidth- 28, g_Locale->getText(LOCALE_TIMERLIST_MODIFY), COL_INFOBAR, 0, true); // UTF-8 - } + ::paintButtons( x, y + height, width, 4, TimerListButtons); + } void CTimerList::paint() diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 242991997..0b2643188 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -79,6 +79,7 @@ const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UP const struct button_label StopButton = {NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_AUDIOPLAYER_STOP}; const struct button_label PUpButton = {NEUTRINO_ICON_BUTTON_RED , LOCALE_FILEBROWSER_NEXTPAGE}; const struct button_label PDownButton = {NEUTRINO_ICON_BUTTON_GREEN , LOCALE_FILEBROWSER_PREVPAGE}; +const struct button_label PPlayButton = {NEUTRINO_ICON_BUTTON_OKAY , LOCALE_AUDIOPLAYER_PLAY}; //------------------------------------------------------------------------ @@ -1051,11 +1052,10 @@ void CUpnpBrowserGui::paintDevice() // Foot top = m_y + (m_height - m_info_height - 2 * m_buttonHeight); - int ButtonWidth = (m_width - 20) / 4; + //int ButtonWidth = (m_width - 20) / 4; m_frameBuffer->paintBoxRel(m_x, top, m_width, 1 * m_buttonHeight, COL_MENUHEAD_PLUS_0, c_rad_mid, CORNER_BOTTOM); - m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 1, &RescanButton); +// m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); + ::paintButtons(m_x, top, 0, 1, &RescanButton, m_buttonHeight); clearItem2DetailsLine(); // clear it } @@ -1177,19 +1177,13 @@ void CUpnpBrowserGui::paintItem(std::vector *entry, unsigned int sele // Foot buttons top = m_y + (m_height - m_info_height - 2 * m_buttonHeight); int ButtonWidth = (m_width - 20) / 4; - m_frameBuffer->paintBoxRel(m_x, top, m_width, 1 * m_buttonHeight+2, COL_MENUHEAD_PLUS_0); - m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 1, &StopButton); - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth, 1, &PUpButton); - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 2 * ButtonWidth + 10, top + 4, ButtonWidth, 1, &PDownButton); - - m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, m_x + 3 * ButtonWidth + 10, top + 1); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + 3 * ButtonWidth + 40, - top + 19 + 4, ButtonWidth - 40, - g_Locale->getText(LOCALE_AUDIOPLAYER_PLAY), COL_INFOBAR, 0, true); // UTF-8 + m_frameBuffer->paintBoxRel(m_x, top, m_width, m_buttonHeight+2, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); +// m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); + + ::paintButtons(m_x, top, 0, 1, &StopButton, m_buttonHeight); + ::paintButtons(m_x + ButtonWidth, top, 0, 1, &PUpButton, m_buttonHeight); + ::paintButtons(m_x + 2 * ButtonWidth, top, 0, 1, &PDownButton, m_buttonHeight); + ::paintButtons(m_x + 3 * ButtonWidth, top, 0, 1, &PPlayButton, m_buttonHeight); } @@ -1199,34 +1193,38 @@ void CUpnpBrowserGui::paintDetails(std::vector *entry, unsigned int i { // Foot info int top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; + int text_start = m_x + 10; if ((!use_playing) && ((*entry)[index].isdir)) { - m_frameBuffer->paintBackgroundBoxRel(m_x, top + 2, m_width, 2 * m_buttonHeight); + m_frameBuffer->paintBackgroundBoxRel(m_x+2, top + 2, m_width-4, 2 * m_buttonHeight+8); } else { // char cNoch[50]; // UTF-8 // char cSeit[50]; // UTF-8 - - if (use_playing) { - if (!m_playing_entry_is_shown) { - m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * m_buttonHeight, COL_MENUCONTENTDARK_PLUS_0); + int ih = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight(); + m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * ih, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); + if (use_playing) + { + if (!m_playing_entry_is_shown) + { m_playing_entry_is_shown = true; - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 4, + g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 1 * m_buttonHeight + 4, m_x + m_width - 8, m_playing_entry.title + " - " + m_playing_entry.artist, COL_INFOBAR, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 4, + g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 2 * m_buttonHeight + 4, m_x + m_width - 8, m_playing_entry.album, COL_INFOBAR, 0, true); // UTF-8 } - } else { + } + else + { if (entry == NULL) return; - m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * m_buttonHeight, COL_MENUCONTENTDARK_PLUS_0); m_playing_entry_is_shown = false; - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 4, + g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 1 * m_buttonHeight + 4, m_x + m_width - 8, (*entry)[index].title + " - " + (*entry)[index].artist, COL_INFOBAR, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 4, + g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 2 * m_buttonHeight + 4, m_x + m_width - 8, (*entry)[index].album, COL_INFOBAR, 0, true); // UTF-8 } //// printf("title = %s\n", (*entry)[selected].title.c_str()); @@ -1305,42 +1303,43 @@ void CUpnpBrowserGui::paintItem2DetailsLine (int pos, unsigned int /*ch_index*/) int ypos1 = m_y + m_title_height+0 + m_theight + pos*m_fheight; int ypos2 = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; - int ypos1a = ypos1 + (m_fheight/2)-2; - int ypos2a = ypos2 + (m_info_height/2)-2; + int ypos1a = ypos1 + (m_fheight/2); + int ypos2a = ypos2 + (m_info_height/2)-4; fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6; fb_pixel_t col2 = COL_MENUCONTENT_PLUS_1; // Clear m_frameBuffer->paintBackgroundBoxRel(xpos, m_y + m_title_height, ConnectLineBox_Width, m_height+m_info_height-(m_y + m_title_height)); - if (pos < 0) { + if (pos < 0) m_frameBuffer->paintBackgroundBoxRel(m_x, m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2, m_width, m_info_height); - } + // paint Line if detail info (and not valid list pos) if (pos >= 0) { // 1. col thick line - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 4, m_fheight, col1); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2, 4, m_info_height, col1); + // vertical + int mh = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight() +2; + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 4, m_fheight, col1); //left from item + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2 + mh/2, 4, mh, col1); //left from detailbox - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 4, ypos2a-ypos1a, col1); - - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 4, col1); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos2a, 12, 4, col1); + // long vertical line + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 4, ypos2a-ypos1a, col1); + + // short horizontal lines + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 4, col1); + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos2a, 12, 4, col1); // 2. col small line - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 1, m_fheight, col2); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2, 1, m_info_height, col2); + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 1, m_fheight, col2); + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2 + mh/2, 1, mh, col2); m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 1, ypos2a-ypos1a+4, col2); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 1, col2); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-12, ypos2a, 8, 1, col2); + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 1, col2); + m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-12, ypos2a, 8, 1, col2); - // -- small Frame around infobox - m_frameBuffer->paintBoxRel(m_x , ypos2, 2, m_info_height, col1); - m_frameBuffer->paintBoxRel(m_x+m_width-2, ypos2, 2, m_info_height, col1); - m_frameBuffer->paintBoxRel(m_x , ypos2, m_width-2, 2, col1); - m_frameBuffer->paintBoxRel(m_x , ypos2+m_info_height-2, m_width-2, 2, col1); + // small Frame around infobox + m_frameBuffer->paintBoxFrame(m_x, ypos2, m_width, mh*2-2, 2, col1, RADIUS_LARGE); } } @@ -1367,8 +1366,7 @@ void CUpnpBrowserGui::updateTimes(const bool force) { paintDetails(NULL, 0, true); top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + m_buttonHeight + 4; - m_frameBuffer->paintBoxRel(m_x + m_width - w - 15, top + 1, w + 4, m_buttonHeight, - COL_MENUCONTENTDARK_PLUS_0); + m_frameBuffer->paintBoxRel(m_x + m_width - w - 15, top + 1, w + 4, m_buttonHeight, COL_MENUCONTENTDARK_PLUS_0); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + m_width - w - 11, top + 1 + m_buttonHeight, w, play_time, COL_MENUHEAD); } } diff --git a/src/gui/widget/buttons.cpp b/src/gui/widget/buttons.cpp index 3db193670..6e2c50f79 100644 --- a/src/gui/widget/buttons.cpp +++ b/src/gui/widget/buttons.cpp @@ -1,5 +1,5 @@ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/widget/buttons.cpp,v 1.2 2004/03/14 22:20:05 thegoodguy Exp $ + * $Id: buttons.cpp,v 1.10 2010/07/12 08:24:55 dbt Exp $ * * (C) 2003 by thegoodguy * @@ -23,31 +23,160 @@ #include #endif +#include +#include + #include +#include +#include -#include -#if 1 -void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int count, const struct button_label * const content) -{ - for (unsigned int i = 0; i < count; i++) - { - int iw = 0, ih = 0; - int fh = font->getHeight(); - frameBuffer->getIconSize(content[i].button, &iw, &ih); - frameBuffer->paintIcon(content[i].button, x + i * buttonwidth, y); - font->RenderString(x + i * buttonwidth + iw + 5, y + fh-(fh-ih)/2, buttonwidth - iw - 5, localemanager->getText(content[i].locale), COL_INFOBAR, 0, true); // UTF-8 - } -} -#endif -void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int height, const unsigned int count, const struct button_label * const content) + +/* paintButtons usage, + use this fucntion for painting icons with captions in horizontal or vertical direction. + + * x set horizontal startposition + * y set vertical startposition + * footerwidth set width of buttonbar as similar to footer, value 0 (default) means: do nothing, then paint it extra + * count set count of buttons + * content set struct buttonlabel with iconfile and locales, for an empty text let locale constant empty, so you can paint icons without captions, + * width width of footer, contains the buttons + * footerheigth set height of buttonbar as similar to footer, value 0 (default) means: value calculates automaticly depends of maximal height of icon and caption + * buttonwidth set width of buttonlabel include icon, caption and offsets, value 0 (default), calculates automaticly the buttonwidth, buttons will be paint like a chain + * vertical_paint optional, default value is false (horizontal) sets direction of painted buttons + * fcolor optional, default value is COL_INFOBAR_SHADOW, use it to render font with other color + * alt_buttontext optional, default NULL, overwrites button caption at definied buttonlabel id (see parameter alt_buttontext_id) with this text + * alt_buttontext_id optional, default 0, means id from buttonlable struct which text you will change + */ + +// y-------+ +-----------+ +// | ID0 ID1 | +// | +-----buttonwidth------+---------+-----buttonwidth------+ | +// | [icon][w_space][caption][w_space][icon][w_space][caption] | footerheight +// | | +// rounded +----------------------------------footerwidth----------------------------------+rounded----+ | +// | +// x +// +int paintButtons( const int &x, + const int &y, + const int &footerwidth, + const uint &count, + const struct button_label * const content, + const int &footerheight, + const int &buttonwidth, + bool vertical_paint, + const unsigned char fcolor, + const char * alt_buttontext, + const uint &buttontext_id) { - int iw, ih; - for (unsigned int i = 0; i < count; i++) + CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); + Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + uint cnt = count; + int x_footer = x; + int y_footer = y; + int w_footer = footerwidth; + int h_footer = 0; + + int w_space = 4; //minimal space between caption to icon and between buttons and between border to caption + int x_icon = x_footer+20; + int x_caption = 0; + + int x_button = x_icon; + int w_button = 0; + int h_button = 0; + + //calculate max of h + w + //icon + int h_max_icon = 0; + int w_max_icon = 0; + + //text + int w_max_text = 0; + int h_max_text = font->getHeight(); + + for (uint i = 0; i < cnt; i++) { - int fh = font->getHeight(); - frameBuffer->getIconSize(content[i].button, &iw, &ih); - frameBuffer->paintIcon(content[i].button, x + i * buttonwidth, y, height); - font->RenderString(x + i * buttonwidth + iw + 5, y + (height-fh)/2 + fh, buttonwidth - iw - 5, localemanager->getText(content[i].locale), COL_INFOBAR, 0, true); // UTF-8 + //icon + int w = 0; + int h = 0; + frameBuffer->getIconSize(content[i].button, &w, &h); + h_max_icon = std::max(h_max_icon, h); + w_max_icon = std::max(w_max_icon, w); + + //text + const char * buttontext = content[i].locale ? g_Locale->getText(content[i].locale) : ""; + + //text width + int fwidth = font->getRenderWidth(buttontext, true); + w_max_text = std::max(w_max_text, fwidth); } + + //calculate button width + w_button = buttonwidth == 0 ? (w_max_icon + w_space + w_max_text) : buttonwidth; + + //calculate button heigth + h_button = std::max(h_max_icon, h_max_text); //calculate optimal button height + + //calculate footer heigth + h_footer = footerheight == 0 ? (h_button + 2*w_space) : footerheight; + + //paint footer + if (w_footer > 0) + frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round + + + //baseline + int y_base = y_footer + h_footer/2; + + + for (uint j = 0; j < cnt; j++) + { + const char * caption = NULL; + //set caption... + if (alt_buttontext != NULL && j == buttontext_id) + caption = alt_buttontext; //...with an alternate buttontext + else + caption = content[j].locale ? g_Locale->getText(content[j].locale) : ""; + + const char * icon = content[j].button ? content[j].button : ""; + + //get height/width of icon + int iconw, iconh; + frameBuffer->getIconSize(content[j].button, &iconw, &iconh); + + // calculate baseline startposition of icon and text in y + int y_caption = y_base + h_max_text/2+1; + + // paint icon and text + frameBuffer->paintIcon(icon, x_button , y_base-iconh/2); + x_caption = x_button + iconw + w_space; + font->RenderString(x_caption, y_caption, w_max_text, caption, fcolor, 0, true); // UTF-8 + + /* set next startposition x, if text is length=0 then offset is =renderwidth of icon, + * for generating buttons without captions, + */ + + int lentext = strlen(caption); + if (vertical_paint) + // set x_icon for painting buttons with vertical arrangement + { + if (lentext !=0) + { + x_button = x; + y_base += h_footer; + } + else + { + x_button = x_caption; + } + } + else + { + //set x_icon for painting buttons with horizontal arrangement as default + x_button = lentext !=0 ? (x_button + w_button + 2*w_space) : x_button; + } + } + + return h_footer; } diff --git a/src/gui/widget/buttons.h b/src/gui/widget/buttons.h index 8253f93ef..245bfbd1a 100644 --- a/src/gui/widget/buttons.h +++ b/src/gui/widget/buttons.h @@ -2,7 +2,7 @@ #define __gui_widget_buttons_h__ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/widget/buttons.h,v 1.2 2004/05/25 07:44:16 thegoodguy Exp $ + * $Id: buttons.h,v 1.6 2010/07/12 08:24:55 dbt Exp $ * * (C) 2003 by thegoodguy * @@ -21,10 +21,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ - + #include #include #include +#include typedef struct button_label { @@ -32,7 +33,17 @@ typedef struct button_label neutrino_locale_t locale; } button_label_struct; -void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int count, const struct button_label * const content); -void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int height, const unsigned int count, const struct button_label * const content); - +int paintButtons( const int &x, + const int &y, + const int &footerwidth, + const uint &count, + const struct button_label * const content, + const int &footerheight = 0, + const int &buttonwidth = 0, + bool vertical_paint = false, + const unsigned char fcolor = COL_INFOBAR_SHADOW, + const char * alt_buttontext = NULL, + const uint &buttontext_id = 0); + + #endif /* __gui_widget_buttons_h__ */ diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 915a2104e..095f08a79 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -142,15 +142,16 @@ void CStringInput::init() } mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight(); - - height = hheight+ mheight+ 50; + footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //initial height value for buttonbar + height = hheight+ mheight + 50; if (hint_1 != NONEXISTANT_LOCALE) { height += iheight; if (hint_2 != NONEXISTANT_LOCALE) height += iheight; } - + height += g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //buttonbar; + x = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width)>>1); y = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight()-height)>>1); selected = 0; @@ -470,7 +471,7 @@ int CStringInput::handleOthers(const neutrino_msg_t /*msg*/, const neutrino_msg_ void CStringInput::hide() { - frameBuffer->paintBackgroundBoxRel(x, y, width, height); + frameBuffer->paintBackgroundBoxRel(x, y, width, height + footerHeight); } const char * CStringInput::getHint1(void) @@ -484,7 +485,7 @@ void CStringInput::paint() int icol_w, icol_h; frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); //round - frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);//round + frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0); if (!(iconfile.empty())) { @@ -561,15 +562,15 @@ CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, char* Value, int void CStringInputSMS::initSMS(const char * const Valid_Chars) { last_digit = -1; // no key pressed yet - const char CharList[10][11] = { "0 -_/()<>=", // 9 characters + const char CharList[10][11] = { "0 -_/()<>=", // 10 characters "1+.,:!?\\", - "abc2ä", + "abc2ä", "def3", "ghi4", "jkl5", - "mno6ö", - "pqrs7ß", - "tuv8ü", + "mno6ö", + "pqrs7ß", + "tuv8ü", "wxyz9" }; for (int i = 0; i < 10; i++) @@ -686,30 +687,17 @@ void CStringInputSMS::keyRightPressed() const struct button_label CStringInputSMSButtons[2] = { { NEUTRINO_ICON_BUTTON_RED , LOCALE_STRINGINPUT_CAPS }, -// { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_XXX }, { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_STRINGINPUT_CLEAR } -// { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_XXX } }; void CStringInputSMS::paint() { - int icol_w, icol_h; - int bh, bw, fh; - CStringInput::paint(); - fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - bh = std::max(fh, icol_h+4); - bw = (width - 20) / 2; - frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x+20+140, y+ hheight+ mheight+ iheight* 3+ 30, 0, COL_MENUCONTENT); - frameBuffer->paintBoxRel(x, y+height-bh, width, bh, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - //frameBuffer->paintHLine(x, x+width, y+height-25, COL_INFOBAR_SHADOW_PLUS_0); - - //::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 8, y+height-25+1, 230, 2, CStringInputSMSButtons); - ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y+height-bh, bw, bh, 2, CStringInputSMSButtons); + //buttonbar + ::paintButtons(x, y + height, width, 2, CStringInputSMSButtons); } void CPINInput::paintChar(int pos) diff --git a/src/gui/widget/stringinput.h b/src/gui/widget/stringinput.h index 3f1f2f9b5..a39cf0bcf 100644 --- a/src/gui/widget/stringinput.h +++ b/src/gui/widget/stringinput.h @@ -52,6 +52,7 @@ class CStringInput : public CMenuTarget int hheight; // head font height int mheight; // menu font height int iheight; + int footerHeight; char * head; neutrino_locale_t name;