make feature 'select songs of album around cursor' work in all screens
This commit is contained in:
@@ -1706,34 +1706,30 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (myScreen->allowsSelection())
|
if (myScreen->allowsSelection())
|
||||||
{
|
{
|
||||||
Menu<MPD::Song> *songs = NULL;
|
if (List *mList = myScreen->GetList())
|
||||||
if (myScreen == myPlaylist && !myPlaylist->Items->Empty())
|
|
||||||
songs = myPlaylist->Items;
|
|
||||||
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content)
|
|
||||||
songs = myPlaylistEditor->Content;
|
|
||||||
else if (myScreen == mySearcher)
|
|
||||||
mySearcher->SelectAlbum();
|
|
||||||
|
|
||||||
if (songs && !songs->Empty())
|
|
||||||
{
|
{
|
||||||
size_t pos = songs->Choice();
|
size_t pos = mList->Choice();
|
||||||
std::string album = songs->at(pos).GetAlbum();
|
if (MPD::Song *s = myScreen->GetSong(pos))
|
||||||
List *mList = myScreen->GetList();
|
{
|
||||||
|
std::string album = s->GetAlbum();
|
||||||
|
|
||||||
// select song under cursor
|
// select song under cursor
|
||||||
mList->Select(pos, 1);
|
mList->Select(pos, 1);
|
||||||
// go up
|
// go up
|
||||||
while (pos > 0)
|
while (pos > 0)
|
||||||
{
|
{
|
||||||
if (songs->at(--pos).GetAlbum() != album)
|
s = myScreen->GetSong(--pos);
|
||||||
|
if (!s || s->GetAlbum() != album)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
mList->Select(pos, 1);
|
mList->Select(pos, 1);
|
||||||
}
|
}
|
||||||
// go down
|
// go down
|
||||||
pos = songs->Choice();
|
pos = mList->Choice();
|
||||||
while (pos < songs->Size() - 1)
|
while (pos < mList->Size() - 1)
|
||||||
{
|
{
|
||||||
if (songs->at(++pos).GetAlbum() != album)
|
s = myScreen->GetSong(++pos);
|
||||||
|
if (!s || s->GetAlbum() != album)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
mList->Select(pos, 1);
|
mList->Select(pos, 1);
|
||||||
@@ -1742,6 +1738,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (Keypressed(input, Key.AddSelected))
|
else if (Keypressed(input, Key.AddSelected))
|
||||||
{
|
{
|
||||||
mySelectedItemsAdder->SwitchTo();
|
mySelectedItemsAdder->SwitchTo();
|
||||||
|
|||||||
Reference in New Issue
Block a user