neutrino: hintboxext and messagebox fixes

* CHintBoxExt created the FB window with slightly wrong size
* CMessageBox adds a buttonbar below the hintbox, this could
 draw outside the screen if the screen area was too small
* max height of CHintBoxExt was hardcoded
The fix is not ideal since the init() of CHintBoxExt is now
called a second time after calculating the size of the button
bar. Feel free to submit a better patch :-)


Origin commit data
------------------
Branch: ni/coolstream
Commit: afef14377a
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-07-30 (Mon, 30 Jul 2012)

Origin message was:
------------------
neutrino: hintboxext and messagebox fixes

* CHintBoxExt created the FB window with slightly wrong size
* CMessageBox adds a buttonbar below the hintbox, this could
 draw outside the screen if the screen area was too small
* max height of CHintBoxExt was hardcoded
The fix is not ideal since the init() of CHintBoxExt is now
called a second time after calculating the size of the button
bar. Feel free to submit a better patch :-)


------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2012-07-30 01:48:13 +02:00
parent 6188182b7d
commit ba93d76483
4 changed files with 19 additions and 14 deletions

View File

@@ -65,8 +65,7 @@ void CMessageBox::Init(const CMessageBox::result_ Default, const uint32_t ShowBu
}
fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
b_height = std::max(fh, ih) + 8 + (RADIUS_LARGE / 2);
bb_height = b_height + fh/2 + ButtonSpacing;
m_height += bb_height;
m_bbheight = b_height + fh/2 + ButtonSpacing;
result = Default;
b_width = getButtonWidth();
if (ShowButtons & CMessageBox::mbBtnAlignCenter1)
@@ -101,10 +100,14 @@ void CMessageBox::Init(const CMessageBox::result_ Default, const uint32_t ShowBu
ButtonDistance = ButtonSpacing;
bb_width = b_width * ButtonCount + ButtonDistance * (ButtonCount - 1);
if(bb_width > m_width)
m_width = bb_width;
m_width = bb_width; /* FIXME: what if bigger than screen area? */
else
if (mbBtnAlign == CMessageBox::mbBtnAlignCenter1)
ButtonDistance = (m_width - b_width * ButtonCount) / (ButtonCount + 1);
/* this is ugly: re-init (CHintBoxExt) to recalculate the number of lines and pages */
init(m_caption, m_width, m_iconfile == "" ? NULL : m_iconfile.c_str());
m_height += m_bbheight;
}
void CMessageBox::returnDefaultValueOnTimeout(bool returnDefault)
@@ -138,9 +141,9 @@ void CMessageBox::paintButtons()
else if (mbBtnAlign == CMessageBox::mbBtnAlignRight)
xpos = m_width - bb_width - ButtonSpacing;
int ypos = (m_height - bb_height) + fh/2;
int ypos = (m_height - m_bbheight) + fh/2;
m_window->paintBoxRel(0, m_height - bb_height, m_width, bb_height, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
m_window->paintBoxRel(0, m_height - m_bbheight, m_width, m_bbheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
i = 0;
if (showbuttons & mbYes) {