make feature 'select songs of album around cursor' work in all screens
This commit is contained in:
@@ -1706,39 +1706,36 @@ 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();
|
|
||||||
// select song under cursor
|
|
||||||
mList->Select(pos, 1);
|
|
||||||
// go up
|
|
||||||
while (pos > 0)
|
|
||||||
{
|
{
|
||||||
if (songs->at(--pos).GetAlbum() != album)
|
std::string album = s->GetAlbum();
|
||||||
break;
|
|
||||||
else
|
// select song under cursor
|
||||||
mList->Select(pos, 1);
|
mList->Select(pos, 1);
|
||||||
|
// go up
|
||||||
|
while (pos > 0)
|
||||||
|
{
|
||||||
|
s = myScreen->GetSong(--pos);
|
||||||
|
if (!s || s->GetAlbum() != album)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
mList->Select(pos, 1);
|
||||||
|
}
|
||||||
|
// go down
|
||||||
|
pos = mList->Choice();
|
||||||
|
while (pos < mList->Size() - 1)
|
||||||
|
{
|
||||||
|
s = myScreen->GetSong(++pos);
|
||||||
|
if (!s || s->GetAlbum() != album)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
mList->Select(pos, 1);
|
||||||
|
}
|
||||||
|
ShowMessage("Album around cursor position selected.");
|
||||||
}
|
}
|
||||||
// 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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user