general code cleaning

This commit is contained in:
Andrzej Rybczak
2009-02-15 19:15:52 +01:00
parent 4cdafc5639
commit e6bd98e0a7
24 changed files with 519 additions and 840 deletions

View File

@@ -57,20 +57,14 @@ void Browser::Resize()
void Browser::SwitchTo()
{
if (current_screen != csBrowser
# ifdef HAVE_TAGLIB_H
&& current_screen != csTinyTagEditor
# endif // HAVE_TAGLIB_H
)
{
CLEAR_FIND_HISTORY;
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
myScreen = this;
w->Hide();
current_screen = csBrowser;
// redraw_screen = 1;
redraw_header = 1;
}
if (myScreen == this)
return;
CLEAR_FIND_HISTORY;
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
myScreen = this;
w->Hide();
redraw_header = 1;
}
std::string Browser::Title()
@@ -147,6 +141,13 @@ void Browser::EnterPressed()
void Browser::SpacePressed()
{
if (Config.space_selects && w->Choice() >= (itsBrowsedDir != "/" ? 1 : 0))
{
Select(w);
w->Scroll(wDown);
return;
}
if (w->Empty())
return;
@@ -229,6 +230,11 @@ void Browser::SpacePressed()
w->Scroll(wDown);
}
MPD::Song *Browser::CurrentSong()
{
return !w->Empty() && w->Current().type == itSong ? w->Current().song : 0;
}
namespace
{
const char *supported_extensions[] = { "wma", "asf", "rm", "mp1", "mp2", "mp3", "mp4", "m4a", "flac", "ogg", "wav", "au", "aiff", "aif", "ac3", "aac", "mpc", "it", "mod", "s3m", "xm", "wv", 0 };
@@ -358,7 +364,7 @@ void Browser::GetDirectory(string dir, string subdir)
}
if (highlightme >= 0)
w->Highlight(highlightme);
if (current_screen == csBrowser)
if (myScreen == myBrowser)
w->Hide();
}