gui/moviebrowser.cpp: add support for marked file list to play

This commit is contained in:
[CST] Focus
2014-09-18 18:42:57 +04:00
parent c6388a7106
commit 7d966e8363
8 changed files with 220 additions and 205 deletions

View File

@@ -368,6 +368,16 @@ CMovieBrowser::~CMovieBrowser()
m_vHandlePlayList.clear(); m_vHandlePlayList.clear();
m_vHandleSerienames.clear(); m_vHandleSerienames.clear();
clearListLines();
if (CChannelLogo) {
delete CChannelLogo;
CChannelLogo = NULL;
}
}
void CMovieBrowser::clearListLines()
{
for(int i = 0; i < LF_MAX_ROWS; i++) for(int i = 0; i < LF_MAX_ROWS; i++)
{ {
m_browserListLines.lineArray[i].clear(); m_browserListLines.lineArray[i].clear();
@@ -376,11 +386,7 @@ CMovieBrowser::~CMovieBrowser()
m_FilterLines.lineArray[i].clear(); m_FilterLines.lineArray[i].clear();
} }
m_browserListLines.Icon.clear(); m_browserListLines.Icon.clear();
m_browserListLines.marked.clear();
if (CChannelLogo) {
delete CChannelLogo;
CChannelLogo = NULL;
}
} }
void CMovieBrowser::fileInfoStale(void) void CMovieBrowser::fileInfoStale(void)
@@ -402,14 +408,7 @@ void CMovieBrowser::fileInfoStale(void)
m_vHandlePlayList.clear(); m_vHandlePlayList.clear();
m_vHandleSerienames.clear(); m_vHandleSerienames.clear();
for(int i = 0; i < LF_MAX_ROWS; i++) clearListLines();
{
m_browserListLines.lineArray[i].clear();
m_recordListLines.lineArray[i].clear();
m_playListLines.lineArray[i].clear();
m_FilterLines.lineArray[i].clear();
}
m_browserListLines.Icon.clear();
} }
void CMovieBrowser::init(void) void CMovieBrowser::init(void)
@@ -978,13 +977,7 @@ int CMovieBrowser::exec(const char* path)
m_vHandleRecordList.clear(); m_vHandleRecordList.clear();
m_vHandlePlayList.clear(); m_vHandlePlayList.clear();
for(int i = 0; i < LF_MAX_ROWS; i++) clearListLines();
{
m_browserListLines.lineArray[i].clear();
m_recordListLines.lineArray[i].clear();
m_playListLines.lineArray[i].clear();
}
m_browserListLines.Icon.clear();
m_selectedDir = path; m_selectedDir = path;
@@ -1058,6 +1051,16 @@ int CMovieBrowser::exec(const char* path)
} }
else if(msg == CRCInput::RC_ok) else if(msg == CRCInput::RC_ok)
{ {
for(unsigned int i = 0; i < m_vMovieInfo.size(); i++) {
if (m_vMovieInfo[i].marked) {
TRACE("[mb] has selected\n");
res = true;
break;
}
}
if (res)
break;
m_currentStartPos = 0; m_currentStartPos = 0;
if(m_movieSelectionHandler != NULL) if(m_movieSelectionHandler != NULL)
@@ -1240,6 +1243,19 @@ CFile* CMovieBrowser::getSelectedFile(void)
return(NULL); return(NULL);
} }
bool CMovieBrowser::getSelectedFiles(CFileList &flist, MI_MOVIE_LIST &mlist)
{
flist.clear();
mlist.clear();
for(unsigned int i = 0; i < m_vMovieInfo.size(); i++) {
if (m_vMovieInfo[i].marked) {
flist.push_back(m_vMovieInfo[i].file);
mlist.push_back(m_vMovieInfo[i]);
}
}
return (!flist.empty());
}
std::string CMovieBrowser::getScreenshotName(std::string movie) std::string CMovieBrowser::getScreenshotName(std::string movie)
{ {
std::string ext; std::string ext;
@@ -1589,8 +1605,9 @@ void CMovieBrowser::refreshBrowserList(void) //P1
m_browserListLines.lineArray[row].clear(); m_browserListLines.lineArray[row].clear();
m_browserListLines.rowWidth[row] = m_settings.browserRowWidth[row]; m_browserListLines.rowWidth[row] = m_settings.browserRowWidth[row];
m_browserListLines.lineHeader[row]= g_Locale->getText(m_localizedItemName[m_settings.browserRowItem[row]]); m_browserListLines.lineHeader[row]= g_Locale->getText(m_localizedItemName[m_settings.browserRowItem[row]]);
m_browserListLines.Icon.clear();
} }
m_browserListLines.Icon.clear();
m_browserListLines.marked.clear();
m_vHandleBrowserList.clear(); m_vHandleBrowserList.clear();
if(m_vMovieInfo.empty()) if(m_vMovieInfo.empty())
@@ -1634,6 +1651,7 @@ void CMovieBrowser::refreshBrowserList(void) //P1
m_browserListLines.Icon.push_back(NEUTRINO_ICON_REC); m_browserListLines.Icon.push_back(NEUTRINO_ICON_REC);
else else
m_browserListLines.Icon.push_back(""); m_browserListLines.Icon.push_back("");
m_browserListLines.marked.push_back(m_vHandleBrowserList[handle]->marked);
} }
m_pcBrowser->setLines(&m_browserListLines); m_pcBrowser->setLines(&m_browserListLines);
@@ -2002,6 +2020,12 @@ bool CMovieBrowser::onButtonPressBrowserList(neutrino_msg_t msg)
{ {
m_pcBrowser->scrollPageDown(1); m_pcBrowser->scrollPageDown(1);
} }
else if (msg == CRCInput::RC_play)
{
m_movieSelectionHandler->marked = !m_movieSelectionHandler->marked;
m_pcBrowser->setSelectedMarked(m_movieSelectionHandler->marked);
m_pcBrowser->scrollLineDown(1);
}
else else
{ {
// default // default

View File

@@ -338,6 +338,7 @@ class CMovieBrowser : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
std::string getCurrentDir(void); //P1 for FileBrowser compatibility std::string getCurrentDir(void); //P1 for FileBrowser compatibility
CFile* getSelectedFile(void); //P1 for FileBrowser compatibility CFile* getSelectedFile(void); //P1 for FileBrowser compatibility
bool getSelectedFiles(CFileList &flist, MI_MOVIE_LIST &mlist); //P1 for FileBrowser compatibility
MI_MOVIE_BOOKMARKS* getCurrentMovieBookmark(void){if(m_movieSelectionHandler == NULL) return NULL; return(&(m_movieSelectionHandler->bookmarks));}; MI_MOVIE_BOOKMARKS* getCurrentMovieBookmark(void){if(m_movieSelectionHandler == NULL) return NULL; return(&(m_movieSelectionHandler->bookmarks));};
int getCurrentStartPos(void){return(m_currentStartPos);}; //P1 return start position in [s] int getCurrentStartPos(void){return(m_currentStartPos);}; //P1 return start position in [s]
MI_MOVIE_INFO* getCurrentMovieInfo(void){return(m_movieSelectionHandler);}; //P1 return start position in [s] MI_MOVIE_INFO* getCurrentMovieInfo(void){return(m_movieSelectionHandler);}; //P1 return start position in [s]
@@ -433,6 +434,7 @@ class CMovieBrowser : public CMenuTarget
void info_hdd_level(bool paint_hdd=false); void info_hdd_level(bool paint_hdd=false);
neutrino_locale_t getFeedLocale(void); neutrino_locale_t getFeedLocale(void);
void clearListLines();
}; };
// Class to show Moviebrowser Information, to be used by menu // Class to show Moviebrowser Information, to be used by menu

View File

@@ -925,6 +925,7 @@ void CMovieInfo::clearMovieInfo(MI_MOVIE_INFO * movie_info)
movie_info->tfile.clear(); movie_info->tfile.clear();
movie_info->ytdate.clear(); movie_info->ytdate.clear();
movie_info->ytid.clear(); movie_info->ytid.clear();
movie_info->marked = false;
} }
/************************************************************************ /************************************************************************

View File

@@ -169,11 +169,13 @@ typedef struct
int epgVideoPid; // currently not used, we just do not want to loose this info if movie info is saved backed int epgVideoPid; // currently not used, we just do not want to loose this info if movie info is saved backed
int VideoType; int VideoType;
int epgVTXPID; // currently not used, we just do not want to loose this info if movie info is saved backed int epgVTXPID; // currently not used, we just do not want to loose this info if movie info is saved backed
bool marked;
std::string tfile; // thumbnail/cover file name std::string tfile; // thumbnail/cover file name
std::string ytdate; // yt published std::string ytdate; // yt published
std::string ytid; // yt published std::string ytid; // yt published
} MI_MOVIE_INFO; } MI_MOVIE_INFO;
typedef std::vector<MI_MOVIE_INFO> MI_MOVIE_LIST;
class CMovieInfo class CMovieInfo
{ {

View File

@@ -94,7 +94,6 @@ CMoviePlayerGui::~CMoviePlayerGui()
delete filebrowser; delete filebrowser;
delete bookmarkmanager; delete bookmarkmanager;
delete playback; delete playback;
filelist.clear();
instance_mp = NULL; instance_mp = NULL;
} }
@@ -226,25 +225,14 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
perror(MOVIEPLAYER_START_SCRIPT " failed"); perror(MOVIEPLAYER_START_SCRIPT " failed");
Cleanup(); Cleanup();
ClearFlags();
isMovieBrowser = false; ClearQueue();
isBookmark = false;
timeshift = 0;
isHTTP = false;
isUPNP = false;
isWebTV = false;
isYT = false;
filelist_it = filelist.end();
filelist.clear();
if (actionKey == "tsmoviebrowser") { if (actionKey == "tsmoviebrowser") {
isMovieBrowser = true; isMovieBrowser = true;
moviebrowser->setMode(MB_SHOW_RECORDS); moviebrowser->setMode(MB_SHOW_RECORDS);
} }
else if (actionKey == "ytplayback") { else if (actionKey == "ytplayback") {
CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
isMovieBrowser = true; isMovieBrowser = true;
moviebrowser->setMode(MB_SHOW_YT); moviebrowser->setMode(MB_SHOW_YT);
isYT = true; isYT = true;
@@ -267,12 +255,12 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
#endif #endif
else if (actionKey == "upnp") { else if (actionKey == "upnp") {
isUPNP = true; isUPNP = true;
is_file_player = 1; is_file_player = false;
PlayFile(); PlayFile();
} }
else if (actionKey == "http") { else if (actionKey == "http") {
isHTTP = true; isHTTP = true;
is_file_player = 1; is_file_player = false;
PlayFile(); PlayFile();
} }
else { else {
@@ -298,11 +286,6 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
if (isYT) {
CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
}
if (timeshift) { if (timeshift) {
timeshift = 0; timeshift = 0;
return menu_return::RETURN_EXIT_ALL; return menu_return::RETURN_EXIT_ALL;
@@ -376,7 +359,6 @@ void CMoviePlayerGui::fillPids()
void CMoviePlayerGui::Cleanup() void CMoviePlayerGui::Cleanup()
{ {
/*clear audiopids */
for (int i = 0; i < numpida; i++) { for (int i = 0; i < numpida; i++) {
apids[i] = 0; apids[i] = 0;
ac3flags[i] = 0; ac3flags[i] = 0;
@@ -395,6 +377,32 @@ void CMoviePlayerGui::Cleanup()
currentaudioname = "Unk"; currentaudioname = "Unk";
} }
void CMoviePlayerGui::ClearFlags()
{
isMovieBrowser = false;
isBookmark = false;
isHTTP = false;
isUPNP = false;
isWebTV = false;
isYT = false;
is_file_player = false;
timeshift = TSHIFT_MODE_OFF;
}
void CMoviePlayerGui::ClearQueue()
{
repeat_mode = REPEAT_OFF;
filelist.clear();
filelist_it = filelist.end();
milist.clear();
}
void CMoviePlayerGui::EnableClockAndMute(bool enable)
{
CAudioMute::getInstance()->enableMuteIcon(enable);
InfoClock->enableInfoClock(enable);
}
void CMoviePlayerGui::makeFilename() void CMoviePlayerGui::makeFilename()
{ {
if (pretty_name.empty()) { if (pretty_name.empty()) {
@@ -423,7 +431,18 @@ bool CMoviePlayerGui::prepareFile(CFile *file)
currentspid = -1; currentspid = -1;
numsubs = 0; numsubs = 0;
file_name = file->Name; file_name = file->Name;
if(file->getType() == CFile::FILE_PLAYLIST) if (isMovieBrowser) {
if (filelist_it != filelist.end()) {
unsigned idx = filelist_it - filelist.begin();
p_movie_info = &milist[idx];
}
if (isYT) {
file_name = file->Url;
is_file_player = true;
}
fillPids();
}
else if (file->getType() == CFile::FILE_PLAYLIST)
parsePlaylist(file); parsePlaylist(file);
else if (file->getType() == CFile::FILE_ISO) else if (file->getType() == CFile::FILE_ISO)
ret = mountIso(file); ret = mountIso(file);
@@ -466,33 +485,29 @@ bool CMoviePlayerGui::SelectFile()
} }
#endif #endif
else if (isMovieBrowser) { else if (isMovieBrowser) {
EnableClockAndMute(false);
if (moviebrowser->exec(Path_local.c_str())) { if (moviebrowser->exec(Path_local.c_str())) {
// get the current path and file name
Path_local = moviebrowser->getCurrentDir(); Path_local = moviebrowser->getCurrentDir();
CFile *file; CFile *file = NULL;
if ((file = moviebrowser->getSelectedFile()) != NULL) { filelist_it = filelist.end();
// get the movie info handle (to be used for e.g. bookmark handling) if (moviebrowser->getSelectedFiles(filelist, milist)) {
filelist_it = filelist.begin();
p_movie_info = &(*milist.begin());
file = &(*filelist_it);
}
else if ((file = moviebrowser->getSelectedFile()) != NULL) {
p_movie_info = moviebrowser->getCurrentMovieInfo(); p_movie_info = moviebrowser->getCurrentMovieInfo();
if (moviebrowser->getMode() == MB_SHOW_RECORDS) {
file_name = file->Name;
}
else if (isYT) {
file_name = file->Url;
is_file_player = true;
}
fillPids();
// get the start position for the movie
startposition = 1000 * moviebrowser->getCurrentStartPos(); startposition = 1000 * moviebrowser->getCurrentStartPos();
printf("CMoviePlayerGui::SelectFile: file %s start %d apid %X atype %d vpid %x vtype %d\n", file_name.c_str(), startposition, currentapid, currentac3, vpid, vtype); printf("CMoviePlayerGui::SelectFile: file %s start %d apid %X atype %d vpid %x vtype %d\n", file_name.c_str(), startposition, currentapid, currentac3, vpid, vtype);
ret = true;
} }
if (p_movie_info)
ret = prepareFile(&p_movie_info->file);
} else } else
menu_ret = moviebrowser->getMenuRet(); menu_ret = moviebrowser->getMenuRet();
EnableClockAndMute(true);
} else { // filebrowser } else { // filebrowser
CAudioMute::getInstance()->enableMuteIcon(false); EnableClockAndMute(false);
InfoClock->enableInfoClock(false);
if (filebrowser->exec(Path_local.c_str()) == true) { if (filebrowser->exec(Path_local.c_str()) == true) {
Path_local = filebrowser->getCurrentDir(); Path_local = filebrowser->getCurrentDir();
CFile *file = filebrowser->getSelectedFile(); CFile *file = filebrowser->getSelectedFile();
@@ -508,12 +523,8 @@ bool CMoviePlayerGui::SelectFile()
} }
} else } else
menu_ret = filebrowser->getMenuRet(); menu_ret = filebrowser->getMenuRet();
CAudioMute::getInstance()->enableMuteIcon(true); EnableClockAndMute(true);
InfoClock->enableInfoClock(true);
} }
if (ret)
makeFilename();
//store last multiformat play dir
g_settings.network_nfs_moviedir = Path_local; g_settings.network_nfs_moviedir = Path_local;
return ret; return ret;
@@ -590,25 +601,21 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
} }
Cleanup(); Cleanup();
#if 0 ClearFlags();
isNK = false; ClearQueue();
#endif
isYT = false;
isWebTV = true; isWebTV = true;
is_file_player = 1; is_file_player = true;
isMovieBrowser = false;
isUPNP = false;
isBookmark = false;
timeshift = TSHIFT_MODE_OFF;
isHTTP = true; isHTTP = true;
file_name = file; file_name = file;
pretty_name = name; pretty_name = name;
MI_MOVIE_INFO _mi;
mi.epgTitle = name; movie_info.epgTitle = name;
mi.epgChannel = file; movie_info.epgChannel = file;
mi.epgId = chan; movie_info.epgId = chan;
p_movie_info = &mi; p_movie_info = &movie_info;
bool res = PlayFileStart(); bool res = PlayFileStart();
if (res) { if (res) {
@@ -685,8 +692,8 @@ bool CMoviePlayerGui::PlayFileStart(void)
if (p_movie_info) { if (p_movie_info) {
if (timeshift != TSHIFT_MODE_OFF) { if (timeshift != TSHIFT_MODE_OFF) {
// p_movie_info may be invalidated by CRecordManager while we're still using it. Create and use a copy. // p_movie_info may be invalidated by CRecordManager while we're still using it. Create and use a copy.
mi = *p_movie_info; movie_info = *p_movie_info;
p_movie_info = &mi; p_movie_info = &movie_info;
} }
duration = p_movie_info->length * 60 * 1000; duration = p_movie_info->length * 60 * 1000;
@@ -760,8 +767,7 @@ bool CMoviePlayerGui::PlayFileStart(void)
if (is_file_player) if (is_file_player)
selectAutoLang(); selectAutoLang();
CAudioMute::getInstance()->enableMuteIcon(true); EnableClockAndMute(true);
InfoClock->enableInfoClock(true);
return res; return res;
} }
@@ -837,9 +843,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
if (stop_it) if (stop_it)
playstate = CMoviePlayerGui::STOPPED; playstate = CMoviePlayerGui::STOPPED;
repeat_mode = REPEAT_OFF; ClearQueue();
filelist.clear();
filelist_it = filelist.end();
} else if ((filelist.size() > 0 && msg == (neutrino_msg_t) CRCInput::RC_right)) { } else if ((filelist.size() > 0 && msg == (neutrino_msg_t) CRCInput::RC_right)) {
if (filelist_it < (filelist.end() - 1)) { if (filelist_it < (filelist.end() - 1)) {
++filelist_it; ++filelist_it;
@@ -855,13 +859,12 @@ void CMoviePlayerGui::PlayFileLoop(void)
playstate = CMoviePlayerGui::STOPPED; playstate = CMoviePlayerGui::STOPPED;
--filelist_it; --filelist_it;
} }
} else if(!timeshift && !isWebTV && !isYT && (msg == (neutrino_msg_t) g_settings.mpkey_next_repeat_mode)) { } else if (!timeshift && !isWebTV /* && !isYT */ && (msg == (neutrino_msg_t) g_settings.mpkey_next_repeat_mode)) {
repeat_mode = (repeat_mode_enum)((int)repeat_mode + 1); repeat_mode = (repeat_mode_enum)((int)repeat_mode + 1);
if (repeat_mode > (int) REPEAT_ALL) if (repeat_mode > (int) REPEAT_ALL)
repeat_mode = REPEAT_OFF; repeat_mode = REPEAT_OFF;
g_settings.movieplayer_repeat_on = repeat_mode; g_settings.movieplayer_repeat_on = repeat_mode;
callInfoViewer(); callInfoViewer();
} else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) {
if (time_forced) { if (time_forced) {
time_forced = false; time_forced = false;
@@ -1009,9 +1012,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
menu_ret = menu_return::RETURN_EXIT_ALL; menu_ret = menu_return::RETURN_EXIT_ALL;
playstate = CMoviePlayerGui::STOPPED; playstate = CMoviePlayerGui::STOPPED;
repeat_mode = REPEAT_OFF; ClearQueue();
filelist.clear();
filelist_it = filelist.end();
g_RCInput->postMsg(msg, data); g_RCInput->postMsg(msg, data);
} else if (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER) { } else if (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER) {
if (playstate == CMoviePlayerGui::PLAY && (position >= 300000 || (duration<300000 && (position>(duration /2))))) if (playstate == CMoviePlayerGui::PLAY && (position >= 300000 || (duration<300000 && (position>(duration /2)))))
@@ -1025,9 +1026,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
printf("CMoviePlayerGui::PlayFile: neutrino handleMsg messages_return::cancel_all\n"); printf("CMoviePlayerGui::PlayFile: neutrino handleMsg messages_return::cancel_all\n");
menu_ret = menu_return::RETURN_EXIT_ALL; menu_ret = menu_return::RETURN_EXIT_ALL;
playstate = CMoviePlayerGui::STOPPED; playstate = CMoviePlayerGui::STOPPED;
repeat_mode = REPEAT_OFF; ClearQueue();
filelist.clear();
filelist_it = filelist.end();
} }
else if (msg <= CRCInput::RC_MaxRC ) { else if (msg <= CRCInput::RC_MaxRC ) {
update_lcd = true; update_lcd = true;
@@ -1071,8 +1070,6 @@ void CMoviePlayerGui::PlayFileEnd(bool restore)
if (restore) if (restore)
restoreNeutrino(); restoreNeutrino();
CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
stopped = true; stopped = true;
printf("%s: stopped\n", __func__); printf("%s: stopped\n", __func__);
if (filelist.size() > 0 && filelist_it != filelist.end()) { if (filelist.size() > 0 && filelist_it != filelist.end()) {

View File

@@ -114,7 +114,8 @@ class CMoviePlayerGui : public CMenuTarget
bool showStartingHint; bool showStartingHint;
CMovieBrowser* moviebrowser; CMovieBrowser* moviebrowser;
MI_MOVIE_INFO * p_movie_info; MI_MOVIE_INFO * p_movie_info;
MI_MOVIE_INFO mi; MI_MOVIE_INFO movie_info;
MI_MOVIE_LIST milist;
const static short MOVIE_HINT_BOX_TIMER = 5; // time to show bookmark hints in seconds const static short MOVIE_HINT_BOX_TIMER = 5; // time to show bookmark hints in seconds
/* playback from file */ /* playback from file */
@@ -173,6 +174,9 @@ class CMoviePlayerGui : public CMenuTarget
void makeScreenShot(bool autoshot = false, bool forcover = false); void makeScreenShot(bool autoshot = false, bool forcover = false);
void Cleanup(); void Cleanup();
void ClearFlags();
void ClearQueue();
void EnableClockAndMute(bool enable);
static void *ShowStartHint(void *arg); static void *ShowStartHint(void *arg);
static void* bgPlayThread(void *arg); static void* bgPlayThread(void *arg);

View File

@@ -415,43 +415,11 @@ void CListFrame::refreshList(void)
if( m_nNrOfLines <= 0) if( m_nNrOfLines <= 0)
return; return;
int y = m_cFrameListRel.iY + TEXT_BORDER_WIDTH ;
for(int line = m_nCurrentLine; for(int line = m_nCurrentLine;
line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage; line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage;
line++) line++)
{ {
uint32_t color = LIST_FONT_COLOR; refreshLine(line);
// draw 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, m_cFrameListRel.iWidth,
m_nFontListHeight, LIST_BACKGROUND_COLOR_SELECTED,
RADIUS_LARGE);
}
int width;
int x = m_cFrameListRel.iX + TEXT_BORDER_WIDTH;
y += m_nFontListHeight;
int xDiff = paintListIcon(x, y, line);
int net_width = m_cFrameListRel.iWidth - ROW_BORDER_WIDTH * (m_pLines->rows - 1);
for(int row = 0; row < m_pLines->rows; row++)
{
width = m_pLines->rowWidth[row] * net_width / 100 ;
if(width > m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH)
{
width = m_cFrameListRel.iWidth - x + m_cFrameListRel.iX - TEXT_BORDER_WIDTH;
//TRACE(" normalize width to %d , x:%d \r\n",width,x);
}
if (row > 0)
xDiff = 0;
m_pcFontList->RenderString(x+m_cFrame.iX+xDiff, y+m_cFrame.iY,
width-xDiff, m_pLines->lineArray[row][line].c_str(),
color);
x += width + ROW_BORDER_WIDTH;
}
} }
} }
@@ -463,23 +431,30 @@ void CListFrame::refreshLine(int line)
if((line < m_nCurrentLine) && (line > m_nCurrentLine + m_nLinesPerPage)) if((line < m_nCurrentLine) && (line > m_nCurrentLine + m_nLinesPerPage))
return; return;
uint32_t color; uint32_t color, bgcolor;
int rel_line = line - m_nCurrentLine; int rel_line = line - m_nCurrentLine;
int y = m_cFrameListRel.iY + TEXT_BORDER_WIDTH + (rel_line*m_nFontListHeight); int y = m_cFrameListRel.iY + TEXT_BORDER_WIDTH + (rel_line*m_nFontListHeight);
int radius = 0;
bool marked = (!m_pLines->marked.empty() && m_pLines->marked[line]);
if(line == m_nSelectedLine && m_showSelection == true) if(line == m_nSelectedLine && m_showSelection == true)
{ {
color = LIST_FONT_COLOR_SELECTED; color = marked ? COL_MENUCONTENTINACTIVE_TEXT : LIST_FONT_COLOR_SELECTED;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY, bgcolor = marked ? COL_MENUCONTENTSELECTED_PLUS_2 : LIST_BACKGROUND_COLOR_SELECTED;
m_cFrameListRel.iWidth, m_nFontListHeight, LIST_BACKGROUND_COLOR_SELECTED, radius = RADIUS_LARGE;
RADIUS_LARGE); }
else if (marked) {
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_2;
} }
else else
{ {
color = LIST_FONT_COLOR; color = LIST_FONT_COLOR;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY, bgcolor = LIST_BACKGROUND_COLOR;
m_cFrameListRel.iWidth, m_nFontListHeight, LIST_BACKGROUND_COLOR);
} }
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
m_cFrameListRel.iWidth, m_nFontListHeight, bgcolor, radius);
int width; int width;
int x = m_cFrameListRel.iX + TEXT_BORDER_WIDTH; int x = m_cFrameListRel.iX + TEXT_BORDER_WIDTH;
y += m_nFontListHeight; y += m_nFontListHeight;
@@ -669,6 +644,14 @@ bool CListFrame::setSelectedLine(int selection)
return (result); return (result);
} }
void CListFrame::setSelectedMarked(bool enable)
{
if (!m_pLines->marked.empty() && m_nSelectedLine < (int) m_pLines->marked.size()) {
m_pLines->marked[m_nSelectedLine] = enable;
refreshLine(m_nSelectedLine);
}
}
void CListFrame::hide(void) void CListFrame::hide(void)
{ {
if(frameBuffer == NULL) return; if(frameBuffer == NULL) return;

View File

@@ -64,6 +64,7 @@ typedef struct
std::vector<std::string> lineArray[LF_MAX_ROWS]; std::vector<std::string> lineArray[LF_MAX_ROWS];
int rowWidth[LF_MAX_ROWS]; int rowWidth[LF_MAX_ROWS];
std::vector<std::string> Icon; std::vector<std::string> Icon;
std::vector<bool> marked;
}LF_LINES; }LF_LINES;
class CListFrame class CListFrame
@@ -139,6 +140,7 @@ class CListFrame
bool setLines(LF_LINES* lines); bool setLines(LF_LINES* lines);
bool setTitle(char* title); bool setTitle(char* title);
bool setSelectedLine(int selection); bool setSelectedLine(int selection);
void setSelectedMarked(bool enable);
void hide(void); void hide(void);
void paint(void); void paint(void);