add new movement keys: {Up,Down}{Album,Artist}

This commit is contained in:
Frank Blendinger
2010-03-04 15:10:58 +01:00
parent 331107387c
commit 6b5ed187a1
7 changed files with 162 additions and 0 deletions

View File

@@ -264,6 +264,90 @@ void SearchEngine::UpdateFoundList()
}
}
void SearchEngine::Scroll(int input)
{
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
if (pos < StaticOptions - 4)
{
if (Keypressed(input, Key.UpAlbum) ||
Keypressed(input, Key.UpArtist))
w->Highlight(0);
else if (Keypressed(input, Key.DownAlbum) ||
Keypressed(input, Key.DownArtist))
w->Highlight(StaticOptions - 4); // reset
return;
}
// reset button
if (pos == StaticOptions - 4)
{
if (Keypressed(input, Key.UpAlbum) ||
Keypressed(input, Key.UpArtist))
w->Highlight(0);
else if (Keypressed(input, Key.DownAlbum) ||
Keypressed(input, Key.DownArtist))
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
if (pos >= StaticOptions)
{
if (Keypressed(input, Key.UpAlbum))
{
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))
{
std::string album = w->at(pos).second->GetAlbum();
while (pos < w->Size() - 1)
if (w->at(++pos).second->GetAlbum() != album)
break;
}
else if (Keypressed(input, Key.UpArtist))
{
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))
{
std::string artist = w->at(pos).second->GetArtist();
while (pos < w->Size() - 1)
if (w->at(++pos).second->GetArtist() != artist)
break;
}
w->Highlight(pos);
}
}
void SearchEngine::Prepare()
{
for (size_t i = 0; i < w->Size(); ++i)