correct playlist clearing
This commit is contained in:
@@ -529,7 +529,7 @@ void Menu::Highlight(int which)
|
||||
|
||||
int howmuch = itsBeginning-old_beginning;
|
||||
|
||||
if (Abs(howmuch) > itsHeight/2)
|
||||
if (Abs(howmuch) > itsHeight)
|
||||
redraw_screen();
|
||||
else
|
||||
{
|
||||
@@ -561,6 +561,7 @@ void Menu::Clear(bool clear_screen)
|
||||
for (vector<Option *>::iterator it = itsOptions.begin(); it != itsOptions.end(); it++)
|
||||
delete *it;
|
||||
itsOptions.clear();
|
||||
NeedsRedraw.clear();
|
||||
itsStaticsNumber = 0;
|
||||
if (clear_screen)
|
||||
Window::Clear();
|
||||
|
||||
@@ -43,7 +43,7 @@ struct Option
|
||||
class Menu : public Window
|
||||
{
|
||||
public:
|
||||
Menu(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsStaticsNumber(0), itsChoice(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { SetColor(color); }
|
||||
Menu(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsStaticsNumber(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { SetColor(color); }
|
||||
virtual ~Menu();
|
||||
|
||||
virtual void Add(string str) { AddOption(str); }
|
||||
@@ -89,7 +89,6 @@ class Menu : public Window
|
||||
void redraw_screen();
|
||||
bool is_static() { return itsOptions[itsHighlight]->is_static; }
|
||||
|
||||
int itsChoice;
|
||||
int itsBeginning;
|
||||
int itsHighlight;
|
||||
|
||||
|
||||
@@ -1525,7 +1525,6 @@ int main(int argc, char *argv[])
|
||||
ShowMessage("Deleting all songs except now playing one...");
|
||||
mpd_playlist_queue_commit(conn);
|
||||
ShowMessage("Songs deleted!");
|
||||
redraw_me = 1;
|
||||
break;
|
||||
}
|
||||
case 'c': // clear playlist
|
||||
|
||||
@@ -153,7 +153,7 @@ void NcmpcppStatusChanged(MpdObj *conn, ChangedStatusType what)
|
||||
{
|
||||
if (playlist_length < vPlaylist.size())
|
||||
{
|
||||
mPlaylist->Clear(!playlist_length && current_screen == csPlaylist);
|
||||
mPlaylist->Clear(playlist_length < mPlaylist->GetHeight() && current_screen == csPlaylist);
|
||||
for (vector<Song *>::iterator it = vPlaylist.begin(); it != vPlaylist.end(); it++)
|
||||
delete *it;
|
||||
vPlaylist.clear();
|
||||
|
||||
Reference in New Issue
Block a user