mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
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:
@@ -1082,6 +1082,14 @@ bool CFileBrowser::exec(const char * const dirname)
|
|||||||
}
|
}
|
||||||
else
|
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;
|
filelist[selected].Marked = true;
|
||||||
loop = false;
|
loop = false;
|
||||||
res = true;
|
res = true;
|
||||||
@@ -1238,45 +1246,39 @@ void CFileBrowser::hide()
|
|||||||
void CFileBrowser::paintItem(unsigned int pos)
|
void CFileBrowser::paintItem(unsigned int pos)
|
||||||
{
|
{
|
||||||
int colwidth1, colwidth2, colwidth3;
|
int colwidth1, colwidth2, colwidth3;
|
||||||
int c_rad_small;
|
int c_rad_small = 0;
|
||||||
fb_pixel_t color;
|
fb_pixel_t color;
|
||||||
fb_pixel_t bgcolor;
|
fb_pixel_t bgcolor;
|
||||||
int ypos = y+ theight+0 + pos*fheight;
|
int ypos = y+ theight+0 + pos*fheight;
|
||||||
CFile * actual_file = NULL;
|
CFile * actual_file = NULL;
|
||||||
std::string fileicon;
|
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;
|
color = actual_file->Marked ? COL_MENUCONTENTINACTIVE_TEXT : COL_MENUCONTENTSELECTED_TEXT;
|
||||||
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
|
bgcolor = actual_file->Marked ? COL_MENUCONTENTSELECTED_PLUS_2 : COL_MENUCONTENTSELECTED_PLUS_0;
|
||||||
c_rad_small = RADIUS_SMALL;
|
c_rad_small = RADIUS_SMALL;
|
||||||
// paintFoot();
|
}
|
||||||
|
else if (actual_file->Marked)
|
||||||
|
{
|
||||||
|
color = COL_MENUCONTENT_TEXT;
|
||||||
|
bgcolor = COL_MENUCONTENT_PLUS_2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = COL_MENUCONTENT_TEXT;//DARK;
|
color = COL_MENUCONTENT_TEXT;//DARK;
|
||||||
bgcolor = COL_MENUCONTENT_PLUS_0;//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);
|
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))
|
if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode))
|
||||||
colwidth2 = 0;
|
colwidth2 = 0;
|
||||||
else
|
else
|
||||||
@@ -1286,7 +1288,7 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
|
|
||||||
if ( actual_file->Name.length() > 0 )
|
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
|
CVFD::getInstance()->showMenuText(0, FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()).c_str(), -1, true); // UTF-8
|
||||||
|
|
||||||
switch(actual_file->getType())
|
switch(actual_file->getType())
|
||||||
@@ -1298,7 +1300,6 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
case CFile::FILE_FLAC:
|
case CFile::FILE_FLAC:
|
||||||
case CFile::FILE_AAC:
|
case CFile::FILE_AAC:
|
||||||
fileicon = NEUTRINO_ICON_MP3;
|
fileicon = NEUTRINO_ICON_MP3;
|
||||||
// color = COL_MENUCONTENT_TEXT;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFile::FILE_DIR:
|
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);
|
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*/);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user