gui/filebrowser.cpp: fix color for marked files;

do not add selected file on OK press, if there are marked files


Origin commit data
------------------
Commit: 8358e5921e
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-12-11 (Wed, 11 Dec 2013)
This commit is contained in:
[CST] Focus
2013-12-11 14:48:42 +04:00
parent 1e4d533847
commit 4433370b8d

View File

@@ -1082,6 +1082,14 @@ bool CFileBrowser::exec(const char * const dirname)
}
else
{
bool has_selected = false;
for(unsigned int i = 0; i < filelist.size();i++) {
if(filelist[i].Marked) {
has_selected = true;
break;
}
}
if (!has_selected)
filelist[selected].Marked = true;
loop = false;
res = true;
@@ -1238,45 +1246,39 @@ void CFileBrowser::hide()
void CFileBrowser::paintItem(unsigned int pos)
{
int colwidth1, colwidth2, colwidth3;
int c_rad_small;
int c_rad_small = 0;
fb_pixel_t color;
fb_pixel_t bgcolor;
int ypos = y+ theight+0 + pos*fheight;
CFile * actual_file = NULL;
std::string fileicon;
unsigned int curr = liststart + pos;
if (liststart + pos == selected)
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0/*DARK*/);
if (curr >= filelist.size())
return;
actual_file = &filelist[curr];
if (curr == selected)
{
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
color = actual_file->Marked ? COL_MENUCONTENTINACTIVE_TEXT : COL_MENUCONTENTSELECTED_TEXT;
bgcolor = actual_file->Marked ? COL_MENUCONTENTSELECTED_PLUS_2 : COL_MENUCONTENTSELECTED_PLUS_0;
c_rad_small = RADIUS_SMALL;
// paintFoot();
}
else if (actual_file->Marked)
{
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_2;
}
else
{
color = COL_MENUCONTENT_TEXT;//DARK;
bgcolor = COL_MENUCONTENT_PLUS_0;//DARK;
c_rad_small = 0;
}
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_rad_small);
if( (liststart + pos) < filelist.size() )
{
actual_file = &filelist[liststart+pos];
if (actual_file->Marked)
{
if (liststart + pos == selected) {
color = COL_MENUCONTENTINACTIVE_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_2;
}
else {
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_2;
}
}
if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode))
colwidth2 = 0;
else
@@ -1286,7 +1288,7 @@ void CFileBrowser::paintItem(unsigned int pos)
if ( actual_file->Name.length() > 0 )
{
if (liststart+pos==selected)
if (curr == selected)
CVFD::getInstance()->showMenuText(0, FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()).c_str(), -1, true); // UTF-8
switch(actual_file->getType())
@@ -1298,7 +1300,6 @@ void CFileBrowser::paintItem(unsigned int pos)
case CFile::FILE_FLAC:
case CFile::FILE_AAC:
fileicon = NEUTRINO_ICON_MP3;
// color = COL_MENUCONTENT_TEXT;
break;
case CFile::FILE_DIR:
@@ -1375,9 +1376,6 @@ void CFileBrowser::paintItem(unsigned int pos)
fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color);
}
}
}
else
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0/*DARK*/);
}
//------------------------------------------------------------------------