neutrino: make button bar use available space intelligently

modify the paintButtons() function, so that it spreads the buttons
over the available width with constant space between them.
Port over all users to the new method and clean up quite some custom
button drawing code on the way.

Attention: This code is GPL v3+ only for now!
This commit is contained in:
Stefan Seyfried
2011-10-03 19:41:19 +02:00
parent 90bb145049
commit 2f65aea744
16 changed files with 192 additions and 191 deletions

View File

@@ -1702,13 +1702,12 @@ const struct button_label ScondLineButtons[2] =
else
top = m_y + (m_height - 2 * m_buttonHeight);
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_x, top+m_buttonHeight, m_width, 2, ScondLineButtons, m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top+m_buttonHeight, m_width, 2, ScondLineButtons, m_width, m_buttonHeight);
if (m_key_level == 0)
@@ -1716,37 +1715,37 @@ const struct button_label ScondLineButtons[2] =
if (m_playlist.empty())
{
if (m_inetmode)
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[7], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[7], m_width, m_buttonHeight);
else
::paintButtons(m_x, top, m_width, 1, &(AudioPlayerButtons[7][0]), m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 1, &(AudioPlayerButtons[7][0]), m_width, m_buttonHeight);
}
else if (m_inetmode)
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[8], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[8], m_width, m_buttonHeight);
else
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[1], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[1], m_width, m_buttonHeight);
}
else if (m_key_level == 1)
{
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[0], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 4, AudioPlayerButtons[0], m_width, m_buttonHeight);
else
::paintButtons( m_x, top, m_width, 2, AudioPlayerButtons[6], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[6], m_width, m_buttonHeight);
}
else
{ // key_level == 2
if (m_state == CAudioPlayerGui::STOP)
{
if (m_select_title_by_name)
::paintButtons(m_x /*+ ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[5], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[5], m_width, m_buttonHeight);
else
::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[4], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[4], m_width, m_buttonHeight);
}
else
{
if (m_select_title_by_name)
::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[3], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[3], m_width, m_buttonHeight);
else
::paintButtons(m_x/* + ButtonWidth*/, top, m_width, 2, AudioPlayerButtons[2], m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top, m_width, 2, AudioPlayerButtons[2], m_width, m_buttonHeight);
}
}
}