fix shadow stuff and initializers....

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@118 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
mws
2009-12-23 12:08:43 +00:00
parent 8070a9613d
commit 6e718d8987
30 changed files with 492 additions and 482 deletions

View File

@@ -32,7 +32,7 @@
Module Name: listframe.cpp .
Description: Implementation of the CListFrame class
This class provides a plain Listbox with numerous rows and lines.
This class provides a plain Listbox with numerous rows and lines.
Date: Nov 2005
@@ -61,10 +61,10 @@
#define SCROLL_MARKER_BORDER 2
#define MAX_WINDOW_WIDTH (frameBuffer->getScreenWidth() - 40)
#define MAX_WINDOW_HEIGHT (frameBuffer->getScreenHeight() - 40)
#define MAX_WINDOW_HEIGHT (frameBuffer->getScreenHeight() - 40)
#define MIN_WINDOW_WIDTH (frameBuffer->getScreenWidth() >> 1)
#define MIN_WINDOW_HEIGHT 40
#define MIN_WINDOW_HEIGHT 40
#define TITLE_BACKGROUND_COLOR ((CFBWindow::color_t)COL_MENUHEAD_PLUS_0)
#define HEADER_LIST_BACKGROUND_COLOR ((CFBWindow::color_t)COL_MENUCONTENT_PLUS_0)
@@ -75,7 +75,7 @@
#define TITLE_FONT_COLOR COL_MENUHEAD
#define HEADER_LIST_FONT_COLOR COL_MENUCONTENT
#define LIST_FONT_COLOR COL_MENUCONTENT
//#define LIST_FONT_COLOR_SELECTED COL_MENUCONTENT
//#define LIST_FONT_COLOR_SELECTED COL_MENUCONTENT
#define LIST_FONT_COLOR_SELECTED COL_MENUCONTENTSELECTED
#define FONT_LIST g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]
@@ -86,7 +86,7 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CListFrame::CListFrame( LF_LINES* lines, Font* font_text, const int mode,
CListFrame::CListFrame( LF_LINES* lines, Font* font_text, const int pmode,
const CBox* position, const char* textTitle, Font* font_title)
{
//TRACE("[CListFrame] new\r\n");
@@ -106,20 +106,20 @@ CListFrame::CListFrame( LF_LINES* lines, Font* font_text, const int mode,
m_nMaxWidth = m_cFrame.iWidth;
}
m_nMode = mode;
m_nMode = pmode;
#if 0
TRACE(" Mode: ");
if(mode & SCROLL) TRACE("SCROLL ");
if(mode & AUTO_WIDTH) TRACE("AUTO_WIDTH ");
if(mode & AUTO_HIGH) TRACE("AUTO_HIGH");
if(pmode & SCROLL) TRACE("SCROLL ");
if(pmode & AUTO_WIDTH) TRACE("AUTO_WIDTH ");
if(pmode & AUTO_HIGH) TRACE("AUTO_HIGH");
TRACE("\r\n");
#endif
if(font_title != NULL)
if(font_title != NULL)
m_pcFontTitle = font_title;
if( textTitle != NULL)
if( textTitle != NULL)
m_textTitle = textTitle;
m_nFontListHeight = m_pcFontList->getHeight();
@@ -131,7 +131,7 @@ CListFrame::CListFrame( LF_LINES* lines, Font* font_text, const int mode,
/* Initialise the window frames first */
initFramesRel();
// than refresh text line array
// than refresh text line array
onNewLineArray();
}
@@ -151,7 +151,7 @@ CListFrame::CListFrame( LF_LINES* lines)
/* Initialise the window frames first */
initFramesRel();
// than refresh text line array
// than refresh text line array
onNewLineArray();
}
@@ -160,7 +160,7 @@ CListFrame::CListFrame()
//TRACE("[CListFrame] new\r\n");
initVar();
initFramesRel();
m_pLines = NULL;
}
@@ -175,19 +175,19 @@ void CListFrame::initVar(void)
frameBuffer = CFrameBuffer::getInstance();
//TRACE("[CListFrame]->InitVar\r\n");
m_nMode = SCROLL;
m_showSelection = true;
m_pcFontList = FONT_LIST ;
m_nFontListHeight = m_pcFontList->getHeight();
m_pcFontHeaderList = FONT_HEADER_LIST ;
m_nFontHeaderListHeight = m_pcFontHeaderList->getHeight();
m_pcFontTitle = FONT_TITLE;
m_textTitle = "MovieBrowser";
m_nFontTitleHeight = m_pcFontTitle->getHeight();
m_nNrOfPages = 1;
m_nNrOfLines = 0;
m_nNrOfRows = 1;
@@ -289,7 +289,7 @@ void CListFrame::initFramesRel(void)
}
m_cFrameListRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth;
if(m_nMode & HEADER_LINE)
{
m_cFrameHeaderListRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth;
@@ -299,7 +299,7 @@ void CListFrame::initFramesRel(void)
}
void CListFrame::onNewLineArray(void)
{
{
//TRACE("[CListFrame]->onNewLineArray \r\n");
int maxTextWidth = 0;
@@ -312,7 +312,7 @@ void CListFrame::onNewLineArray(void)
{
reSizeMainFrameWidth(maxTextWidth);
}
if(m_nMode & AUTO_HIGH)
{
reSizeMainFrameHeight(m_nNrOfLines * m_nFontListHeight);
@@ -357,12 +357,12 @@ void CListFrame::refreshTitle(void)
//TRACE("[CListFrame]->refreshHeaderList \r\n");
if( frameBuffer == NULL) return;
frameBuffer->paintBoxRel(m_cFrameTitleRel.iX+m_cFrame.iX, m_cFrameTitleRel.iY+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameTitleRel.iX+m_cFrame.iX, m_cFrameTitleRel.iY+m_cFrame.iY,
m_cFrameTitleRel.iWidth, m_cFrameTitleRel.iHeight, TITLE_BACKGROUND_COLOR);
m_pcFontTitle->RenderString(m_cFrameTitleRel.iX + TEXT_BORDER_WIDTH + m_cFrame.iX,
m_cFrameTitleRel.iY + m_cFrameTitleRel.iHeight + m_cFrame.iY,
m_cFrameTitleRel.iWidth - (TEXT_BORDER_WIDTH << 1),
m_pcFontTitle->RenderString(m_cFrameTitleRel.iX + TEXT_BORDER_WIDTH + m_cFrame.iX,
m_cFrameTitleRel.iY + m_cFrameTitleRel.iHeight + m_cFrame.iY,
m_cFrameTitleRel.iWidth - (TEXT_BORDER_WIDTH << 1),
m_textTitle.c_str(), TITLE_FONT_COLOR, 0, true); // UTF-8
}
@@ -372,19 +372,19 @@ void CListFrame::refreshScroll(void)
if( frameBuffer == NULL) return;
if(!(m_nMode & SCROLL)) return;
if (m_nNrOfPages > 1)
if (m_nNrOfPages > 1)
{
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_MENUCONTENT_PLUS_1);
unsigned int marker_size = m_cFrameScrollRel.iHeight / m_nNrOfPages;
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER+m_cFrame.iX,
m_cFrameScrollRel.iY + m_nCurrentPage * marker_size +m_cFrame.iY,
m_cFrameScrollRel.iWidth - (2*SCROLL_MARKER_BORDER),
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER+m_cFrame.iX,
m_cFrameScrollRel.iY + m_nCurrentPage * marker_size +m_cFrame.iY,
m_cFrameScrollRel.iWidth - (2*SCROLL_MARKER_BORDER),
marker_size, COL_MENUCONTENT_PLUS_3);
}
else
{
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_MENUCONTENT_PLUS_0);
}
}
@@ -393,15 +393,15 @@ void CListFrame::refreshList(void)
{
//TRACE("[CListFrame]->refreshList: %d\r\n",m_nCurrentLine);
if( frameBuffer == NULL) return;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, m_cFrameListRel.iY+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, m_cFrameListRel.iY+m_cFrame.iY,
m_cFrameListRel.iWidth, m_cFrameListRel.iHeight, LIST_BACKGROUND_COLOR);
if( m_nNrOfLines <= 0)
if( m_nNrOfLines <= 0)
return;
int y = m_cFrameListRel.iY + TEXT_BORDER_WIDTH ;
for(int line = m_nCurrentLine;
line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage;
line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage;
line++)
{
int color = LIST_FONT_COLOR;
@@ -409,8 +409,8 @@ void CListFrame::refreshList(void)
if(line == m_nSelectedLine && m_showSelection == true)
{
color = LIST_FONT_COLOR_SELECTED;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX,
y+m_cFrame.iY, m_cFrameListRel.iWidth,
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX,
y+m_cFrame.iY, m_cFrameListRel.iWidth,
m_nFontListHeight, LIST_BACKGROUND_COLOR_SELECTED,
ROUND_RADIUS);
}
@@ -425,10 +425,10 @@ void CListFrame::refreshList(void)
width = m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH;
//TRACE(" normalize width to %d , x:%d \r\n",width,x);
}
m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineArray[row][line].c_str(),
m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineArray[row][line].c_str(),
color, 0, true); // UTF-8
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
}
}
}
@@ -448,14 +448,14 @@ void CListFrame::refreshLine(int line)
if(line == m_nSelectedLine && m_showSelection == true)
{
color = LIST_FONT_COLOR_SELECTED;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
m_cFrameListRel.iWidth, m_nFontListHeight, LIST_BACKGROUND_COLOR_SELECTED,
ROUND_RADIUS);
}
else
{
color = LIST_FONT_COLOR;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
m_cFrameListRel.iWidth, m_nFontListHeight, LIST_BACKGROUND_COLOR);
}
int width;
@@ -469,10 +469,10 @@ void CListFrame::refreshLine(int line)
width = m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - 2*TEXT_BORDER_WIDTH;
//TRACE(" normalize to %d,x:%d\r\n",width,x);
}
m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineArray[row][line].c_str(),
m_pcFontList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineArray[row][line].c_str(),
color, 0, true); // UTF-8
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
}
}
@@ -482,7 +482,7 @@ void CListFrame::refreshHeaderList(void)
if( frameBuffer == NULL) return;
if(!(m_nMode & HEADER_LINE))return;
frameBuffer->paintBoxRel(m_cFrameHeaderListRel.iX+m_cFrame.iX, m_cFrameHeaderListRel.iY+m_cFrame.iY,
frameBuffer->paintBoxRel(m_cFrameHeaderListRel.iX+m_cFrame.iX, m_cFrameHeaderListRel.iY+m_cFrame.iY,
m_cFrameHeaderListRel.iWidth, m_cFrameHeaderListRel.iHeight, HEADER_LIST_BACKGROUND_COLOR);
int width;
@@ -498,10 +498,10 @@ void CListFrame::refreshHeaderList(void)
//TRACE(" normalize width to %d , x:%d \r\n",width,x);
loop = false;
}
m_pcFontHeaderList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineHeader[row].c_str(),
m_pcFontHeaderList->RenderString(x+m_cFrame.iX, y+m_cFrame.iY,
width, m_pLines->lineHeader[row].c_str(),
HEADER_LIST_FONT_COLOR, 0, true); // UTF-8
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
x += m_pLines->rowWidth[row] + ROW_BORDER_WIDTH;
}
}
@@ -511,7 +511,7 @@ void CListFrame::scrollLineDown(const int lines)
if( !(m_nMode & SCROLL)) return;
if( m_nNrOfLines <= 1) return;
if(m_nSelectedLine < m_nNrOfLines - 1) {
m_nSelectedLine++;
// check if the cursor moves out of the window
@@ -528,7 +528,7 @@ void CListFrame::scrollLineDown(const int lines)
m_nCurrentLine = m_nSelectedLine = 0;
refreshList();
}
}
void CListFrame::scrollLineUp(const int lines)
@@ -562,16 +562,16 @@ void CListFrame::scrollPageDown(const int pages)
if( !(m_nMode & SCROLL)) return;
if( m_nNrOfLines <= 1) return;
if(m_nCurrentPage + pages < m_nNrOfPages)
{
m_nCurrentPage += pages;
m_nCurrentPage += pages;
}
else
else
{
m_nCurrentPage = m_nNrOfPages - 1;
}
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
if(m_nSelectedLine < m_nCurrentLine || m_nSelectedLine -m_nCurrentLine >= m_nLinesPerPage )
{
m_nSelectedLine = m_nCurrentLine;
@@ -589,13 +589,13 @@ void CListFrame::scrollPageUp(const int pages)
if(m_nCurrentPage - pages > 0)
{
m_nCurrentPage -= pages;
m_nCurrentPage -= pages;
}
else
else
{
m_nCurrentPage = 0;
}
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
if(m_nSelectedLine < m_nCurrentLine || m_nSelectedLine - m_nCurrentLine >= m_nLinesPerPage )
{
m_nSelectedLine = m_nCurrentLine;
@@ -617,7 +617,7 @@ void CListFrame::refresh(void)
bool CListFrame::setLines(LF_LINES* lines)
{
if(lines == NULL)
if(lines == NULL)
return(false);
//TRACE("[CListFrame]->setLines \r\n");
@@ -628,7 +628,7 @@ bool CListFrame::setLines(LF_LINES* lines)
m_nNrOfRows = LF_MAX_ROWS;
onNewLineArray();
refresh();
return(true);
}
@@ -640,7 +640,7 @@ bool CListFrame::setTitle(char* title)
m_textTitle = title;
refreshTitle();
return(true);
}
@@ -649,7 +649,7 @@ bool CListFrame::setSelectedLine(int selection)
//TRACE("[CListFrame]->setSelectedLine %d \r\n",selection);
bool result = false;
if(selection >= 0 && selection < m_nNrOfLines)
{
{
m_nSelectedLine = selection;
m_nCurrentPage = selection / m_nLinesPerPage;
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
@@ -658,7 +658,7 @@ bool CListFrame::setSelectedLine(int selection)
result = true;
//TRACE(" selected line: %d,%d,%d \r\n",m_nSelectedLine,m_nCurrentPage,m_nCurrentLine);
}
return (result);
}