minor fixes for moving and deleting items

This commit is contained in:
unK
2008-09-15 20:52:25 +02:00
parent 90b975f04d
commit e029c2cd09
2 changed files with 26 additions and 19 deletions

View File

@@ -1703,6 +1703,7 @@ int main(int argc, char *argv[])
{
if (!mPlaylist->Empty() && current_screen == csPlaylist)
{
block_playlist_update = 1;
if (mPlaylist->IsAnySelected())
{
vector<int> list;
@@ -1717,15 +1718,17 @@ int main(int argc, char *argv[])
}
else
{
block_playlist_update = 1;
dont_change_now_playing = 1;
mPlaylist->SetTimeout(50);
while (!mPlaylist->Empty() && Keypressed(input, Key.Delete))
{
int id = mPlaylist->GetChoice();
TraceMpdStatus();
timer = time(NULL);
Mpd->QueueDeleteSong(mPlaylist->GetChoice());
mPlaylist->DeleteOption(mPlaylist->GetChoice());
if (now_playing > id) // needed for keeping proper
now_playing--; // position of now playing song.
Mpd->QueueDeleteSong(id);
mPlaylist->DeleteOption(id);
mPlaylist->Refresh();
mPlaylist->ReadKey(input);
}
@@ -1892,6 +1895,9 @@ int main(int argc, char *argv[])
{
int from, to;
from = to = mPlaylist->GetChoice();
// unbold now playing as if song changes during move, this won't be unbolded.
if (to == now_playing && to > 0)
mPlaylist->BoldOption(now_playing, 0);
while (Keypressed(input, Key.MvSongUp) && to > 0)
{
TraceMpdStatus();
@@ -1984,6 +1990,9 @@ int main(int argc, char *argv[])
{
int from, to;
from = to = mPlaylist->GetChoice();
// unbold now playing as if song changes during move, this won't be unbolded.
if (to == now_playing && to < mPlaylist->Size()-1)
mPlaylist->BoldOption(now_playing, 0);
while (Keypressed(input, Key.MvSongDown) && to < mPlaylist->Size()-1)
{
TraceMpdStatus();

View File

@@ -284,8 +284,6 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
if (changed.SongID)
{
if (!mPlaylist->Empty() && now_playing >= 0)
{
if (!mPlaylist->Empty())
{
if (Config.repeat_one_mode && repeat_one_allowed)
{
@@ -298,7 +296,7 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
if (Config.autocenter_mode)
mPlaylist->Highlight(now_playing);
repeat_one_allowed = 0;
}
if (!Mpd->GetElapsedTime())
mvwhline(wFooter->RawWin(), 0, 0, 0, wFooter->GetWidth());
}