improvements for 6b5ed187

This commit is contained in:
Andrzej Rybczak
2010-03-05 21:13:53 +01:00
parent 4562167b8e
commit a63e1fa27d

View File

@@ -267,61 +267,40 @@ void SearchEngine::UpdateFoundList()
void SearchEngine::Scroll(int input) void SearchEngine::Scroll(int input)
{ {
size_t pos = w->Choice(); size_t pos = w->Choice();
size_t oldpos = pos;
//w->Goto(pos);
//w->Goto(pos2);
//std::string album = w->at(pos).second->GetAlbum();
//ShowMessage("pos (choice): %i / pos2 (realchoice): %i / album: %s", pos, pos2, album.c_str());
//return;
// above the reset button // above the reset button
if (pos < StaticOptions - 4) if (pos < ResetButton)
{ {
if (Keypressed(input, Key.UpAlbum) || if (Keypressed(input, Key.UpAlbum) || Keypressed(input, Key.UpArtist))
Keypressed(input, Key.UpArtist))
w->Highlight(0); w->Highlight(0);
else if (Keypressed(input, Key.DownAlbum) || else if (Keypressed(input, Key.DownAlbum) || Keypressed(input, Key.DownArtist))
Keypressed(input, Key.DownArtist)) w->Highlight(ResetButton);
w->Highlight(StaticOptions - 4); // reset
return;
} }
// reset button // reset button
if (pos == StaticOptions - 4) else if (pos == ResetButton)
{ {
if (Keypressed(input, Key.UpAlbum) || if (Keypressed(input, Key.UpAlbum) || Keypressed(input, Key.UpArtist))
Keypressed(input, Key.UpArtist))
w->Highlight(0); w->Highlight(0);
else if (Keypressed(input, Key.DownAlbum) || else if (Keypressed(input, Key.DownAlbum) || Keypressed(input, Key.DownArtist))
Keypressed(input, Key.DownArtist)) w->Highlight(StaticOptions); // first search result
w->Highlight(StaticOptions); // first search result
return;
} }
// first search result
if (pos == StaticOptions)
{
if (Keypressed(input, Key.UpAlbum))
{
w->Highlight(StaticOptions - 4); // reset
return;
}
else if (Keypressed(input, Key.UpArtist))
{
w->Highlight(0);
return;
}
}
// we are in the search results at this point // we are in the search results at this point
if (pos >= StaticOptions) else if (pos >= StaticOptions)
{ {
if (Keypressed(input, Key.UpAlbum)) if (Keypressed(input, Key.UpAlbum))
{ {
std::string album = w->at(pos).second->GetAlbum(); if (pos == StaticOptions)
while (pos > StaticOptions) {
if (w->at(--pos).second->GetAlbum() != album) w->Highlight(ResetButton);
break; return;
}
else
{
std::string album = w->at(pos).second->GetAlbum();
while (pos > StaticOptions)
if (w->at(--pos).second->GetAlbum() != album)
break;
}
} }
else if (Keypressed(input, Key.DownAlbum)) else if (Keypressed(input, Key.DownAlbum))
{ {
@@ -332,10 +311,18 @@ void SearchEngine::Scroll(int input)
} }
else if (Keypressed(input, Key.UpArtist)) else if (Keypressed(input, Key.UpArtist))
{ {
std::string artist = w->at(pos).second->GetArtist(); if (pos == StaticOptions)
while (pos > StaticOptions) {
if (w->at(--pos).second->GetArtist() != artist) w->Highlight(0);
break; return;
}
else
{
std::string artist = w->at(pos).second->GetArtist();
while (pos > StaticOptions)
if (w->at(--pos).second->GetArtist() != artist)
break;
}
} }
else if (Keypressed(input, Key.DownArtist)) else if (Keypressed(input, Key.DownArtist))
{ {