add key_select_album: select album around cursor

Default key for this is 'B'. This use to be the default for
ToggleBitrateVisibility, which has changed to '#'.
This commit is contained in:
Frank Blendinger
2010-07-03 19:53:01 +02:00
committed by Andrzej Rybczak
parent 4d406c85f2
commit 7600429383
5 changed files with 48 additions and 2 deletions

View File

@@ -1694,6 +1694,44 @@ int main(int argc, char *argv[])
ShowMessage("Items deselected!");
}
}
else if (Keypressed(input, Key.SelectAlbum))
{
if (myScreen->allowsSelection())
{
Menu<MPD::Song> *songs = NULL;
if (myScreen == myPlaylist && !myPlaylist->Items->Empty())
songs = myPlaylist->Items;
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content)
songs = myPlaylistEditor->Content;
if (songs && !songs->Empty())
{
size_t pos = songs->Choice();
std::string album = songs->at(pos).GetAlbum();
List *mList = myScreen->GetList();
// select song under cursor
mList->Select(pos, 1);
// go up
while (pos > 0)
{
if (songs->at(--pos).GetAlbum() != album)
break;
else
mList->Select(pos, 1);
}
// go down
pos = songs->Choice();
while (pos < songs->Size() - 1)
{
if (songs->at(++pos).GetAlbum() != album)
break;
else
mList->Select(pos, 1);
}
ShowMessage("Album around cursor position selected.");
}
}
}
else if (Keypressed(input, Key.AddSelected))
{
mySelectedItemsAdder->SwitchTo();