general code cleaning
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
bin_PROGRAMS = ncmpcpp
|
bin_PROGRAMS = ncmpcpp
|
||||||
ncmpcpp_SOURCES = browser.cpp charset.cpp clock.cpp display.cpp help.cpp \
|
ncmpcpp_SOURCES = browser.cpp charset.cpp clock.cpp display.cpp help.cpp \
|
||||||
helpers.cpp info.cpp libmpdclient.c lyrics.cpp media_library.cpp misc.cpp mpdpp.cpp \
|
helpers.cpp info.cpp libmpdclient.c lyrics.cpp media_library.cpp misc.cpp mpdpp.cpp \
|
||||||
ncmpcpp.cpp playlist.cpp playlist_editor.cpp scrollpad.cpp search_engine.cpp \
|
ncmpcpp.cpp playlist.cpp playlist_editor.cpp screen.cpp scrollpad.cpp \
|
||||||
settings.cpp song.cpp status_checker.cpp str_pool.c tag_editor.cpp window.cpp
|
search_engine.cpp settings.cpp song.cpp status_checker.cpp str_pool.c tag_editor.cpp \
|
||||||
|
window.cpp
|
||||||
|
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
INCLUDES= $(all_includes)
|
INCLUDES= $(all_includes)
|
||||||
|
|||||||
@@ -57,21 +57,15 @@ void Browser::Resize()
|
|||||||
|
|
||||||
void Browser::SwitchTo()
|
void Browser::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csBrowser
|
if (myScreen == this)
|
||||||
# ifdef HAVE_TAGLIB_H
|
return;
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
|
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = csBrowser;
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::string Browser::Title()
|
std::string Browser::Title()
|
||||||
{
|
{
|
||||||
@@ -147,6 +141,13 @@ void Browser::EnterPressed()
|
|||||||
|
|
||||||
void Browser::SpacePressed()
|
void Browser::SpacePressed()
|
||||||
{
|
{
|
||||||
|
if (Config.space_selects && w->Choice() >= (itsBrowsedDir != "/" ? 1 : 0))
|
||||||
|
{
|
||||||
|
Select(w);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (w->Empty())
|
if (w->Empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -229,6 +230,11 @@ void Browser::SpacePressed()
|
|||||||
w->Scroll(wDown);
|
w->Scroll(wDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPD::Song *Browser::CurrentSong()
|
||||||
|
{
|
||||||
|
return !w->Empty() && w->Current().type == itSong ? w->Current().song : 0;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const char *supported_extensions[] = { "wma", "asf", "rm", "mp1", "mp2", "mp3", "mp4", "m4a", "flac", "ogg", "wav", "au", "aiff", "aif", "ac3", "aac", "mpc", "it", "mod", "s3m", "xm", "wv", 0 };
|
const char *supported_extensions[] = { "wma", "asf", "rm", "mp1", "mp2", "mp3", "mp4", "m4a", "flac", "ogg", "wav", "au", "aiff", "aif", "ac3", "aac", "mpc", "it", "mod", "s3m", "xm", "wv", 0 };
|
||||||
@@ -358,7 +364,7 @@ void Browser::GetDirectory(string dir, string subdir)
|
|||||||
}
|
}
|
||||||
if (highlightme >= 0)
|
if (highlightme >= 0)
|
||||||
w->Highlight(highlightme);
|
w->Highlight(highlightme);
|
||||||
if (current_screen == csBrowser)
|
if (myScreen == myBrowser)
|
||||||
w->Hide();
|
w->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#ifndef _BROWSER_H
|
#ifndef _BROWSER_H
|
||||||
#define _BROWSER_H
|
#define _BROWSER_H
|
||||||
|
|
||||||
#include "mpdpp.h"
|
|
||||||
#include "ncmpcpp.h"
|
#include "ncmpcpp.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
@@ -39,6 +38,8 @@ class Browser : public Screen< Menu<MPD::Item> >
|
|||||||
virtual void EnterPressed();
|
virtual void EnterPressed();
|
||||||
virtual void SpacePressed();
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
const std::string &CurrentDir() { return itsBrowsedDir; }
|
const std::string &CurrentDir() { return itsBrowsedDir; }
|
||||||
|
|
||||||
void GetDirectory(std::string, std::string = "/");
|
void GetDirectory(std::string, std::string = "/");
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void Clock::Resize()
|
|||||||
if (Width <= size_t(COLS) && Height <= main_height)
|
if (Width <= size_t(COLS) && Height <= main_height)
|
||||||
{
|
{
|
||||||
w->MoveTo((COLS-Width)/2, (LINES-Height)/2);
|
w->MoveTo((COLS-Width)/2, (LINES-Height)/2);
|
||||||
if (current_screen == csClock)
|
if (myScreen == myClock)
|
||||||
{
|
{
|
||||||
myPlaylist->Main()->Hide();
|
myPlaylist->Main()->Hide();
|
||||||
Prepare();
|
Prepare();
|
||||||
@@ -71,23 +71,18 @@ void Clock::SwitchTo()
|
|||||||
if (Width > size_t(COLS) || Height > main_height)
|
if (Width > size_t(COLS) || Height > main_height)
|
||||||
{
|
{
|
||||||
ShowMessage("Screen is too small to display clock!");
|
ShowMessage("Screen is too small to display clock!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (
|
if (myScreen == this)
|
||||||
current_screen != csClock
|
return;
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
myPlaylist->Main()->Hide();
|
myPlaylist->Main()->Hide();
|
||||||
current_screen = csClock;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
Clock::Prepare();
|
Prepare();
|
||||||
w->Display();
|
w->Display();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::string Clock::Title()
|
std::string Clock::Title()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ namespace Global
|
|||||||
extern std::string editor_highlighted_dir;
|
extern std::string editor_highlighted_dir;
|
||||||
// extern std::string info_title;
|
// extern std::string info_title;
|
||||||
|
|
||||||
extern NcmpcppScreen current_screen;
|
// extern BasicScreen myScreen;
|
||||||
extern NcmpcppScreen prev_screen;
|
// extern NcmpcppScreen myOldScreen;
|
||||||
|
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
extern pthread_mutex_t curl;
|
extern pthread_mutex_t curl;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "tag_editor.h"
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
|
||||||
@@ -43,15 +44,14 @@ void Help::Resize()
|
|||||||
|
|
||||||
void Help::SwitchTo()
|
void Help::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csHelp
|
if (myScreen != myHelp
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
&& current_screen != csTinyTagEditor
|
&& myScreen != myTinyTagEditor
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = csHelp;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
127
src/info.cpp
127
src/info.cpp
@@ -84,67 +84,19 @@ void Info::GetSong()
|
|||||||
if (myScreen == this)
|
if (myScreen == this)
|
||||||
{
|
{
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
|
||||||
myScreen = myOldScreen;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
myScreen->Refresh();
|
||||||
{
|
|
||||||
myLibrary->Refresh();
|
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Refresh();
|
MPD::Song *s = myScreen->CurrentSong();
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
if (!s)
|
||||||
else if (current_screen == csTagEditor)
|
return;
|
||||||
{
|
|
||||||
myTagEditor->Refresh();
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
}
|
|
||||||
else if (
|
|
||||||
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
|
||||||
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
|
||||||
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|
||||||
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
MPD::Song *s = 0;
|
|
||||||
size_t id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
|
||||||
switch (current_screen)
|
|
||||||
{
|
|
||||||
case csPlaylist:
|
|
||||||
s = &myPlaylist->Main()->at(id);
|
|
||||||
break;
|
|
||||||
case csBrowser:
|
|
||||||
s = myBrowser->Main()->at(id).song;
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
s = mySearcher->Main()->at(id).second;
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
s = &myLibrary->Songs->at(id);
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
s = &myPlaylistEditor->Content->at(id);
|
|
||||||
break;
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTagEditor:
|
|
||||||
s = &myTagEditor->Tags->at(id);
|
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
|
||||||
current_screen = csInfo;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
itsTitle = "Song info";
|
itsTitle = "Song info";
|
||||||
w->Clear();
|
w->Clear();
|
||||||
@@ -161,36 +113,11 @@ void Info::GetArtist()
|
|||||||
if (myScreen == this)
|
if (myScreen == this)
|
||||||
{
|
{
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
|
||||||
myScreen = myOldScreen;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
myScreen->Refresh();
|
||||||
{
|
|
||||||
myLibrary->Refresh();
|
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else
|
||||||
{
|
|
||||||
myPlaylistEditor->Refresh();
|
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
else if (current_screen == csTagEditor)
|
|
||||||
{
|
|
||||||
myTagEditor->Refresh();
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
}
|
|
||||||
else if (
|
|
||||||
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
|
||||||
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
|
||||||
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Artists && !myLibrary->Artists->Empty())
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|
||||||
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (Downloader && !ArtistReady)
|
if (Downloader && !ArtistReady)
|
||||||
{
|
{
|
||||||
@@ -201,38 +128,18 @@ void Info::GetArtist()
|
|||||||
Update();
|
Update();
|
||||||
|
|
||||||
string *artist = new string();
|
string *artist = new string();
|
||||||
size_t id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
|
||||||
switch (current_screen)
|
MPD::Song *s = myScreen->CurrentSong();
|
||||||
{
|
|
||||||
case csPlaylist:
|
if (!s && myScreen->Cmp() != myLibrary->Artists)
|
||||||
*artist = myPlaylist->Main()->at(id).GetArtist();
|
return;
|
||||||
break;
|
|
||||||
case csBrowser:
|
*artist = !s ? myLibrary->Artists->Current() : s->GetArtist();
|
||||||
*artist = myBrowser->Main()->at(id).song->GetArtist();
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
*artist = mySearcher->Main()->at(id).second->GetArtist();
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
*artist = myLibrary->Artists->at(id);
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
*artist = myPlaylistEditor->Content->at(id).GetArtist();
|
|
||||||
break;
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTagEditor:
|
|
||||||
*artist = myTagEditor->Tags->at(id).GetArtist();
|
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!artist->empty())
|
if (!artist->empty())
|
||||||
{
|
{
|
||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
|
||||||
current_screen = csInfo;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
itsTitle = "Artist's info - " + *artist;
|
itsTitle = "Artist's info - " + *artist;
|
||||||
w->Clear();
|
w->Clear();
|
||||||
|
|||||||
@@ -87,36 +87,11 @@ void Lyrics::SwitchTo()
|
|||||||
if (myScreen == this && !Reload)
|
if (myScreen == this && !Reload)
|
||||||
{
|
{
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
|
||||||
myScreen = myOldScreen;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
myScreen->Refresh();
|
||||||
{
|
|
||||||
myLibrary->Refresh();
|
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else
|
||||||
{
|
|
||||||
myPlaylistEditor->Refresh();
|
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
else if (current_screen == csTagEditor)
|
|
||||||
{
|
|
||||||
myTagEditor->Refresh();
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
}
|
|
||||||
else if (
|
|
||||||
Reload
|
|
||||||
|| (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
|
||||||
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
|
||||||
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|
||||||
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
if (Downloader && !Ready)
|
if (Downloader && !Ready)
|
||||||
@@ -131,52 +106,18 @@ void Lyrics::SwitchTo()
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
MPD::Song *s = 0;
|
MPD::Song *s = Reload ? myPlaylist->CurrentSong() : myScreen->CurrentSong();
|
||||||
int id;
|
|
||||||
|
|
||||||
if (Reload)
|
|
||||||
{
|
|
||||||
current_screen = csPlaylist;
|
|
||||||
myScreen = myPlaylist;
|
|
||||||
Reload = 0;
|
Reload = 0;
|
||||||
id = myPlaylist->NowPlaying;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
|
||||||
|
|
||||||
switch (current_screen)
|
if (!s)
|
||||||
{
|
return;
|
||||||
case csPlaylist:
|
|
||||||
s = &myPlaylist->Main()->at(id);
|
|
||||||
break;
|
|
||||||
case csBrowser:
|
|
||||||
s = myBrowser->Main()->at(id).song;
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
s = mySearcher->Main()->at(id).second;
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
s = &myLibrary->Songs->at(id);
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
s = &myPlaylistEditor->Content->at(id);
|
|
||||||
break;
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTagEditor:
|
|
||||||
s = &myTagEditor->Tags->at(id);
|
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!s->GetArtist().empty() && !s->GetTitle().empty())
|
if (!s->GetArtist().empty() && !s->GetTitle().empty())
|
||||||
{
|
{
|
||||||
itsScrollBegin = 0;
|
itsScrollBegin = 0;
|
||||||
itsSong = *s;
|
itsSong = *s;
|
||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
prev_screen = current_screen;
|
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
current_screen = csLyrics;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
w->Clear();
|
w->Clear();
|
||||||
w->WriteXY(0, 0, 0, "Fetching lyrics...");
|
w->WriteXY(0, 0, 0, "Fetching lyrics...");
|
||||||
@@ -201,6 +142,12 @@ std::string Lyrics::Title()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lyrics::SpacePressed()
|
||||||
|
{
|
||||||
|
Config.now_playing_lyrics = !Config.now_playing_lyrics;
|
||||||
|
ShowMessage("Reload lyrics if song changes: %s", Config.now_playing_lyrics ? "On" : "Off");
|
||||||
|
}
|
||||||
|
|
||||||
void *Lyrics::Get(void *song)
|
void *Lyrics::Get(void *song)
|
||||||
{
|
{
|
||||||
string artist = static_cast<MPD::Song *>(song)->GetArtist();
|
string artist = static_cast<MPD::Song *>(song)->GetArtist();
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class Lyrics : public Screen<Scrollpad>
|
|||||||
|
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
|
|
||||||
|
virtual void SpacePressed();
|
||||||
|
|
||||||
static bool Reload;
|
static bool Reload;
|
||||||
|
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
|
|||||||
@@ -103,26 +103,16 @@ void MediaLibrary::Refresh()
|
|||||||
|
|
||||||
void MediaLibrary::SwitchTo()
|
void MediaLibrary::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csLibrary
|
if (myScreen == this)
|
||||||
# ifdef HAVE_TAGLIB_H
|
return;
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
|
||||||
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
|
||||||
MediaLibrary::Refresh();
|
|
||||||
|
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
current_screen = csLibrary;
|
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
||||||
|
redraw_header = 1;
|
||||||
|
Refresh();
|
||||||
UpdateSongList(Songs);
|
UpdateSongList(Songs);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::string MediaLibrary::Title()
|
std::string MediaLibrary::Title()
|
||||||
{
|
{
|
||||||
@@ -248,6 +238,22 @@ void MediaLibrary::Update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaLibrary::SpacePressed()
|
||||||
|
{
|
||||||
|
if (Config.space_selects && w == Songs)
|
||||||
|
{
|
||||||
|
Select(Songs);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AddToPlaylist(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
MPD::Song *MediaLibrary::CurrentSong()
|
||||||
|
{
|
||||||
|
return w == Songs && !Songs->Empty() ? &Songs->Current() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void MediaLibrary::NextColumn()
|
void MediaLibrary::NextColumn()
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ class MediaLibrary : public Screen<Window>
|
|||||||
virtual void Update();
|
virtual void Update();
|
||||||
|
|
||||||
virtual void EnterPressed() { AddToPlaylist(1); }
|
virtual void EnterPressed() { AddToPlaylist(1); }
|
||||||
virtual void SpacePressed() { AddToPlaylist(0); }
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
void NextColumn();
|
void NextColumn();
|
||||||
void PrevColumn();
|
void PrevColumn();
|
||||||
|
|||||||
378
src/ncmpcpp.cpp
378
src/ncmpcpp.cpp
@@ -75,16 +75,12 @@ int Global::lock_statusbar_delay = -1;
|
|||||||
|
|
||||||
size_t Global::main_start_y;
|
size_t Global::main_start_y;
|
||||||
size_t Global::main_height;
|
size_t Global::main_height;
|
||||||
//size_t Global::lyrics_scroll_begin = 0;
|
|
||||||
|
|
||||||
time_t Global::timer;
|
time_t Global::timer;
|
||||||
|
|
||||||
string Global::editor_browsed_dir = "/";
|
string Global::editor_browsed_dir = "/";
|
||||||
string Global::editor_highlighted_dir;
|
string Global::editor_highlighted_dir;
|
||||||
|
|
||||||
NcmpcppScreen Global::current_screen;
|
|
||||||
NcmpcppScreen Global::prev_screen;
|
|
||||||
|
|
||||||
bool Global::dont_change_now_playing = 0;
|
bool Global::dont_change_now_playing = 0;
|
||||||
bool Global::block_progressbar_update = 0;
|
bool Global::block_progressbar_update = 0;
|
||||||
bool Global::block_playlist_update = 0;
|
bool Global::block_playlist_update = 0;
|
||||||
@@ -179,7 +175,6 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->Display();
|
wFooter->Display();
|
||||||
|
|
||||||
myScreen = myPlaylist;
|
myScreen = myPlaylist;
|
||||||
current_screen = csPlaylist;
|
|
||||||
|
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
|
|
||||||
@@ -225,59 +220,18 @@ int main(int argc, char *argv[])
|
|||||||
const size_t max_allowed_title_length = wHeader ? wHeader->GetWidth()-volume_state.length() : 0;
|
const size_t max_allowed_title_length = wHeader ? wHeader->GetWidth()-volume_state.length() : 0;
|
||||||
if (((past.tv_sec == now.tv_sec && past.tv_usec >= now.tv_usec+500000)
|
if (((past.tv_sec == now.tv_sec && past.tv_usec >= now.tv_usec+500000)
|
||||||
|| past.tv_sec > now.tv_sec)
|
|| past.tv_sec > now.tv_sec)
|
||||||
&& ((current_screen == csBrowser && myBrowser->CurrentDir().length() > max_allowed_title_length)
|
&& ((myScreen == myBrowser && myBrowser->CurrentDir().length() > max_allowed_title_length)
|
||||||
|| current_screen == csLyrics))
|
|| myScreen == myLyrics))
|
||||||
{
|
{
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
gettimeofday(&now, 0);
|
gettimeofday(&now, 0);
|
||||||
}
|
}
|
||||||
if (Config.header_visibility && redraw_header)
|
if (Config.header_visibility && redraw_header)
|
||||||
{
|
{
|
||||||
switch (current_screen)
|
|
||||||
{
|
|
||||||
case csHelp:
|
|
||||||
screen_title = myHelp->Title();
|
|
||||||
break;
|
|
||||||
case csPlaylist:
|
|
||||||
screen_title = myPlaylist->Title();
|
|
||||||
break;
|
|
||||||
case csBrowser:
|
|
||||||
screen_title = myBrowser->Title();
|
|
||||||
break;
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTinyTagEditor:
|
|
||||||
case csTagEditor:
|
|
||||||
screen_title = myTagEditor->Title();
|
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
case csInfo:
|
|
||||||
screen_title = myInfo->Title();
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
screen_title = mySearcher->Title();
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
screen_title = myLibrary->Title();
|
|
||||||
break;
|
|
||||||
case csLyrics:
|
|
||||||
screen_title = myLyrics->Title();
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
screen_title = myPlaylistEditor->Title();
|
|
||||||
break;
|
|
||||||
# ifdef ENABLE_CLOCK
|
|
||||||
case csClock:
|
|
||||||
screen_title = myClock->Title();
|
|
||||||
break;
|
|
||||||
# endif // ENABLE_CLOCK
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (title_allowed)
|
if (title_allowed)
|
||||||
{
|
{
|
||||||
wHeader->Bold(1);
|
wHeader->Bold(1);
|
||||||
wHeader->WriteXY(0, 0, 1, "%s", screen_title.c_str());
|
wHeader->WriteXY(0, 0, 1, "%s", myScreen->Title().c_str());
|
||||||
wHeader->Bold(0);
|
wHeader->Bold(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -305,43 +259,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// header stuff end
|
// header stuff end
|
||||||
|
|
||||||
if (current_screen == csHelp
|
myScreen->Update();
|
||||||
|| current_screen == csPlaylist
|
|
||||||
|| current_screen == csBrowser);
|
|
||||||
else if (current_screen == csLibrary)
|
|
||||||
{
|
|
||||||
myLibrary->Update();
|
|
||||||
}
|
|
||||||
else if (current_screen == csPlaylistEditor)
|
|
||||||
{
|
|
||||||
myPlaylistEditor->Update();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
if (current_screen == csTagEditor)
|
|
||||||
{
|
|
||||||
myTagEditor->Update();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
# ifdef ENABLE_CLOCK
|
|
||||||
if (current_screen == csClock)
|
|
||||||
{
|
|
||||||
myClock->Update();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
if (current_screen == csLyrics)
|
|
||||||
{
|
|
||||||
myLyrics->Update();
|
|
||||||
}
|
|
||||||
else if (current_screen == csInfo)
|
|
||||||
{
|
|
||||||
myInfo->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
myWindow->Main()->Display();
|
myWindow->Main()->Display();
|
||||||
// redraw_screen = 0;
|
|
||||||
|
|
||||||
myWindow->Main()->ReadKey(input);
|
myWindow->Main()->ReadKey(input);
|
||||||
if (input == ERR)
|
if (input == ERR)
|
||||||
@@ -352,16 +272,17 @@ int main(int argc, char *argv[])
|
|||||||
title_allowed = 1;
|
title_allowed = 1;
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
|
|
||||||
switch (current_screen)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
case csPlaylist:
|
|
||||||
myPlaylist->Main()->Highlighting(1);
|
myPlaylist->Main()->Highlighting(1);
|
||||||
break;
|
}
|
||||||
case csLibrary:
|
else if (
|
||||||
case csPlaylistEditor:
|
myScreen == myLibrary
|
||||||
|
|| myScreen == myPlaylistEditor
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
case csTagEditor:
|
|| myScreen == myTagEditor
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (Keypressed(input, Key.Up) || Keypressed(input, Key.Down) || Keypressed(input, Key.PageUp) || Keypressed(input, Key.PageDown) || Keypressed(input, Key.Home) || Keypressed(input, Key.End) || Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward) || Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
if (Keypressed(input, Key.Up) || Keypressed(input, Key.Down) || Keypressed(input, Key.PageUp) || Keypressed(input, Key.PageDown) || Keypressed(input, Key.Home) || Keypressed(input, Key.End) || Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward) || Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
||||||
{
|
{
|
||||||
@@ -384,21 +305,16 @@ int main(int argc, char *argv[])
|
|||||||
myTagEditor->Tags->Clear(0);
|
myTagEditor->Tags->Clear(0);
|
||||||
myTagEditor->TagTypes->Refresh();
|
myTagEditor->TagTypes->Refresh();
|
||||||
}
|
}
|
||||||
// else if (myScreen == myTagEditor->TagTypes)
|
|
||||||
// redraw_screen = 1;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// key mapping beginning
|
// key mapping beginning
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Keypressed(input, Key.Up)
|
Keypressed(input, Key.Up)
|
||||||
#ifdef ENABLE_CLOCK
|
#ifdef ENABLE_CLOCK
|
||||||
&& current_screen != csClock
|
&& myScreen != myClock
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -426,7 +342,7 @@ int main(int argc, char *argv[])
|
|||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.Down)
|
Keypressed(input, Key.Down)
|
||||||
#ifdef ENABLE_CLOCK
|
#ifdef ENABLE_CLOCK
|
||||||
&& current_screen != csClock
|
&& myScreen != myClock
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -454,7 +370,7 @@ int main(int argc, char *argv[])
|
|||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.PageUp)
|
Keypressed(input, Key.PageUp)
|
||||||
#ifdef ENABLE_CLOCK
|
#ifdef ENABLE_CLOCK
|
||||||
&& current_screen != csClock
|
&& myScreen != myClock
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -463,7 +379,7 @@ int main(int argc, char *argv[])
|
|||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.PageDown)
|
Keypressed(input, Key.PageDown)
|
||||||
#ifdef ENABLE_CLOCK
|
#ifdef ENABLE_CLOCK
|
||||||
&& current_screen != csClock
|
&& myScreen != myClock
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -522,17 +438,17 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->Resize(COLS, wFooter->GetHeight());
|
wFooter->Resize(COLS, wFooter->GetHeight());
|
||||||
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
if (current_screen == csLibrary)
|
if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
myLibrary->Refresh();
|
myLibrary->Refresh();
|
||||||
}
|
}
|
||||||
else if (current_screen == csTagEditor)
|
else if (myScreen == myTagEditor)
|
||||||
{
|
{
|
||||||
myTagEditor->Refresh();
|
myTagEditor->Refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
if (current_screen == csPlaylistEditor)
|
if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Refresh();
|
myPlaylistEditor->Refresh();
|
||||||
}
|
}
|
||||||
@@ -556,119 +472,24 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.Enter))
|
else if (Keypressed(input, Key.Enter))
|
||||||
{
|
{
|
||||||
switch (current_screen)
|
myScreen->EnterPressed();
|
||||||
{
|
|
||||||
case csPlaylist:
|
|
||||||
{
|
|
||||||
myPlaylist->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case csBrowser:
|
|
||||||
{
|
|
||||||
myBrowser->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTinyTagEditor:
|
|
||||||
{
|
|
||||||
myTinyTagEditor->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
case csSearcher:
|
|
||||||
{
|
|
||||||
mySearcher->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case csLibrary:
|
|
||||||
{
|
|
||||||
myLibrary->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case csPlaylistEditor:
|
|
||||||
{
|
|
||||||
myPlaylistEditor->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTagEditor:
|
|
||||||
{
|
|
||||||
myTagEditor->EnterPressed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.Space))
|
else if (Keypressed(input, Key.Space))
|
||||||
{
|
{
|
||||||
if (Config.space_selects
|
myScreen->SpacePressed();
|
||||||
|| myScreen == myPlaylist
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| myScreen->Cmp() == myTagEditor->Tags
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (myScreen == myPlaylist
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| myScreen->Cmp() == myTagEditor->Tags
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
|| (myScreen == myBrowser && ((Menu<Song> *)myWindow->Main())->Choice() >= (myBrowser->CurrentDir() != "/" ? 1 : 0)) || (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| myScreen->Cmp() == myLibrary->Songs
|
|
||||||
|| myScreen->Cmp() == myPlaylistEditor->Content)
|
|
||||||
{
|
|
||||||
List *mList = (Menu<Song> *)myWindow->Main();
|
|
||||||
if (mList->Empty())
|
|
||||||
continue;
|
|
||||||
size_t i = mList->Choice();
|
|
||||||
mList->Select(i, !mList->isSelected(i));
|
|
||||||
myWindow->Main()->Scroll(wDown);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (current_screen == csBrowser)
|
|
||||||
{
|
|
||||||
myBrowser->SpacePressed();
|
|
||||||
}
|
|
||||||
else if (current_screen == csSearcher)
|
|
||||||
{
|
|
||||||
mySearcher->SpacePressed();
|
|
||||||
}
|
|
||||||
else if (current_screen == csLibrary)
|
|
||||||
{
|
|
||||||
myLibrary->SpacePressed();
|
|
||||||
}
|
|
||||||
else if (current_screen == csPlaylistEditor)
|
|
||||||
{
|
|
||||||
myPlaylistEditor->SpacePressed();
|
|
||||||
}
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
else if (current_screen == csTagEditor)
|
|
||||||
{
|
|
||||||
myTagEditor->SpacePressed();
|
|
||||||
}
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
else if (current_screen == csLyrics)
|
|
||||||
{
|
|
||||||
Config.now_playing_lyrics = !Config.now_playing_lyrics;
|
|
||||||
ShowMessage("Reload lyrics if song changes: %s", Config.now_playing_lyrics ? "On" : "Off");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.VolumeUp))
|
else if (Keypressed(input, Key.VolumeUp))
|
||||||
{
|
{
|
||||||
if (current_screen == csLibrary && input == Key.VolumeUp[0])
|
if (myScreen == myLibrary && input == Key.VolumeUp[0])
|
||||||
{
|
{
|
||||||
myLibrary->NextColumn();
|
myLibrary->NextColumn();
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor && input == Key.VolumeUp[0])
|
else if (myScreen == myPlaylistEditor && input == Key.VolumeUp[0])
|
||||||
{
|
{
|
||||||
myPlaylistEditor->NextColumn();
|
myPlaylistEditor->NextColumn();
|
||||||
}
|
}
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
else if (current_screen == csTagEditor && input == Key.VolumeUp[0])
|
else if (myScreen == myTagEditor && input == Key.VolumeUp[0])
|
||||||
{
|
{
|
||||||
myTagEditor->NextColumn();
|
myTagEditor->NextColumn();
|
||||||
}
|
}
|
||||||
@@ -678,16 +499,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.VolumeDown))
|
else if (Keypressed(input, Key.VolumeDown))
|
||||||
{
|
{
|
||||||
if (current_screen == csLibrary && input == Key.VolumeDown[0])
|
if (myScreen == myLibrary && input == Key.VolumeDown[0])
|
||||||
{
|
{
|
||||||
myLibrary->PrevColumn();
|
myLibrary->PrevColumn();
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor && input == Key.VolumeDown[0])
|
else if (myScreen == myPlaylistEditor && input == Key.VolumeDown[0])
|
||||||
{
|
{
|
||||||
myPlaylistEditor->PrevColumn();
|
myPlaylistEditor->PrevColumn();
|
||||||
}
|
}
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
else if (current_screen == csTagEditor && input == Key.VolumeDown[0])
|
else if (myScreen == myTagEditor && input == Key.VolumeDown[0])
|
||||||
{
|
{
|
||||||
myTagEditor->PrevColumn();
|
myTagEditor->PrevColumn();
|
||||||
}
|
}
|
||||||
@@ -697,7 +518,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.Delete))
|
else if (Keypressed(input, Key.Delete))
|
||||||
{
|
{
|
||||||
if (!myPlaylist->Main()->Empty() && current_screen == csPlaylist)
|
if (!myPlaylist->Main()->Empty() && myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
if (myPlaylist->Main()->hasSelected())
|
if (myPlaylist->Main()->hasSelected())
|
||||||
@@ -733,11 +554,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Mpd->CommitQueue();
|
Mpd->CommitQueue();
|
||||||
}
|
}
|
||||||
else if (current_screen == csBrowser || myScreen->Cmp() == myPlaylistEditor->List)
|
else if (myScreen == myBrowser || myScreen->Cmp() == myPlaylistEditor->List)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
string name = myScreen == myBrowser ? myBrowser->Main()->Current().name : myPlaylistEditor->List->Current();
|
string name = myScreen == myBrowser ? myBrowser->Main()->Current().name : myPlaylistEditor->List->Current();
|
||||||
if (current_screen != csBrowser || myBrowser->Main()->Current().type == itPlaylist)
|
if (myScreen != myBrowser || myBrowser->Main()->Current().type == itPlaylist)
|
||||||
{
|
{
|
||||||
Statusbar() << "Delete playlist " << name << " ? [y/n] ";
|
Statusbar() << "Delete playlist " << name << " ? [y/n] ";
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
@@ -865,7 +686,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.MvSongUp))
|
else if (Keypressed(input, Key.MvSongUp))
|
||||||
{
|
{
|
||||||
if (current_screen == csPlaylist && !myPlaylist->Main()->Empty())
|
if (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
myPlaylist->Main()->SetTimeout(50);
|
myPlaylist->Main()->SetTimeout(50);
|
||||||
@@ -968,7 +789,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.MvSongDown))
|
else if (Keypressed(input, Key.MvSongDown))
|
||||||
{
|
{
|
||||||
if (current_screen == csPlaylist && !myPlaylist->Main()->Empty())
|
if (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
myPlaylist->Main()->SetTimeout(50);
|
myPlaylist->Main()->SetTimeout(50);
|
||||||
@@ -1197,10 +1018,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.UpdateDB))
|
else if (Keypressed(input, Key.UpdateDB))
|
||||||
{
|
{
|
||||||
if (current_screen == csBrowser)
|
if (myScreen == myBrowser)
|
||||||
Mpd->UpdateDirectory(myBrowser->CurrentDir());
|
Mpd->UpdateDirectory(myBrowser->CurrentDir());
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
else if (current_screen == csTagEditor && !Config.albums_in_tag_editor)
|
else if (myScreen == myTagEditor && !Config.albums_in_tag_editor)
|
||||||
Mpd->UpdateDirectory(editor_browsed_dir);
|
Mpd->UpdateDirectory(editor_browsed_dir);
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
else
|
else
|
||||||
@@ -1208,7 +1029,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.GoToNowPlaying))
|
else if (Keypressed(input, Key.GoToNowPlaying))
|
||||||
{
|
{
|
||||||
if (current_screen == csPlaylist && myPlaylist->isPlaying())
|
if (myScreen == myPlaylist && myPlaylist->isPlaying())
|
||||||
myPlaylist->Main()->Highlight(myPlaylist->NowPlaying);
|
myPlaylist->Main()->Highlight(myPlaylist->NowPlaying);
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.ToggleRepeat))
|
else if (Keypressed(input, Key.ToggleRepeat))
|
||||||
@@ -1324,13 +1145,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if (myTinyTagEditor->SetEdited(myScreen->CurrentSong()))
|
||||||
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
|
||||||
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == itSong)
|
|
||||||
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|
||||||
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|
||||||
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty()))
|
|
||||||
{
|
{
|
||||||
myTinyTagEditor->SwitchTo();
|
myTinyTagEditor->SwitchTo();
|
||||||
}
|
}
|
||||||
@@ -1405,41 +1220,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.GoToContainingDir))
|
else if (Keypressed(input, Key.GoToContainingDir))
|
||||||
{
|
{
|
||||||
if ((myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
Song *s = myScreen->CurrentSong();
|
||||||
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
|
||||||
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|
||||||
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
size_t id = ((Menu<Song> *)myScreen)->Choice();
|
|
||||||
Song *s = 0;
|
|
||||||
switch (current_screen)
|
|
||||||
{
|
|
||||||
case csPlaylist:
|
|
||||||
s = &myPlaylist->Main()->at(id);
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
s = mySearcher->Main()->at(id).second;
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
s = &myLibrary->Songs->at(id);
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
s = &myPlaylistEditor->Content->at(id);
|
|
||||||
break;
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
|
||||||
case csTagEditor:
|
|
||||||
s = &myTagEditor->Tags->at(id);
|
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->GetDirectory().empty()) // for streams
|
if (!s || s->GetDirectory().empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Config.local_browser = !s->IsFromDB();
|
Config.local_browser = !s->IsFromDB();
|
||||||
@@ -1457,7 +1240,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
myBrowser->SwitchTo();
|
myBrowser->SwitchTo();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (Keypressed(input, Key.StartSearching))
|
else if (Keypressed(input, Key.StartSearching))
|
||||||
{
|
{
|
||||||
if (myScreen == mySearcher)
|
if (myScreen == mySearcher)
|
||||||
@@ -1553,15 +1335,12 @@ int main(int argc, char *argv[])
|
|||||||
SongList result;
|
SongList result;
|
||||||
for (vector<size_t>::const_iterator it = list.begin(); it != list.end(); it++)
|
for (vector<size_t>::const_iterator it = list.begin(); it != list.end(); it++)
|
||||||
{
|
{
|
||||||
switch (current_screen)
|
if (myScreen == myPlaylist)
|
||||||
{
|
|
||||||
case csPlaylist:
|
|
||||||
{
|
{
|
||||||
Song *s = new Song(myPlaylist->Main()->at(*it));
|
Song *s = new Song(myPlaylist->Main()->at(*it));
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case csBrowser:
|
else if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
const Item &item = myBrowser->Main()->at(*it);
|
const Item &item = myBrowser->Main()->at(*it);
|
||||||
switch (item.type)
|
switch (item.type)
|
||||||
@@ -1583,38 +1362,30 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case csSearcher:
|
else if (myScreen == mySearcher)
|
||||||
{
|
{
|
||||||
Song *s = new Song(*mySearcher->Main()->at(*it).second);
|
Song *s = new Song(*mySearcher->Main()->at(*it).second);
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case csLibrary:
|
else if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
Song *s = new Song(myLibrary->Songs->at(*it));
|
Song *s = new Song(myLibrary->Songs->at(*it));
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case csPlaylistEditor:
|
else if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
Song *s = new Song(myPlaylistEditor->Content->at(*it));
|
Song *s = new Song(myPlaylistEditor->Content->at(*it));
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t dialog_width = COLS*0.8;
|
size_t dialog_width = COLS*0.8;
|
||||||
size_t dialog_height = LINES*0.6;
|
size_t dialog_height = LINES*0.6;
|
||||||
Menu<string> *mDialog = new Menu<string>((COLS-dialog_width)/2, (LINES-dialog_height)/2, dialog_width, dialog_height, "Add selected items to...", Config.main_color, Config.window_border);
|
Menu<string> *mDialog = new Menu<string>((COLS-dialog_width)/2, (LINES-dialog_height)/2, dialog_width, dialog_height, "Add selected items to...", Config.main_color, Config.window_border);
|
||||||
mDialog->SetTimeout(ncmpcpp_window_timeout);
|
mDialog->SetTimeout(ncmpcpp_window_timeout);
|
||||||
mDialog->SetItemDisplayer(Display::Generic);
|
mDialog->SetItemDisplayer(Display::Generic);
|
||||||
|
|
||||||
bool playlists_not_active = current_screen == csBrowser && Config.local_browser;
|
bool playlists_not_active = myScreen == myBrowser && Config.local_browser;
|
||||||
|
|
||||||
if (playlists_not_active)
|
if (playlists_not_active)
|
||||||
{
|
{
|
||||||
@@ -1635,8 +1406,6 @@ int main(int argc, char *argv[])
|
|||||||
mDialog->AddOption("Cancel");
|
mDialog->AddOption("Cancel");
|
||||||
|
|
||||||
mDialog->Display();
|
mDialog->Display();
|
||||||
prev_screen = current_screen;
|
|
||||||
current_screen = csOther;
|
|
||||||
|
|
||||||
while (!Keypressed(input, Key.Enter))
|
while (!Keypressed(input, Key.Enter))
|
||||||
{
|
{
|
||||||
@@ -1658,15 +1427,14 @@ int main(int argc, char *argv[])
|
|||||||
mDialog->Scroll(wEnd);
|
mDialog->Scroll(wEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_screen = prev_screen;
|
|
||||||
size_t id = mDialog->Choice();
|
size_t id = mDialog->Choice();
|
||||||
|
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
if (current_screen == csLibrary)
|
if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
myLibrary->Refresh();
|
myLibrary->Refresh();
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Refresh();
|
myPlaylistEditor->Refresh();
|
||||||
}
|
}
|
||||||
@@ -1764,14 +1532,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
||||||
{
|
{
|
||||||
if ((current_screen == csHelp
|
if ((myScreen == myHelp
|
||||||
|| current_screen == csSearcher
|
|| myScreen == mySearcher
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| current_screen == csTinyTagEditor
|
|| myScreen == myTinyTagEditor
|
||||||
|| myScreen->Cmp() == myTagEditor->TagTypes
|
|| myScreen->Cmp() == myTagEditor->TagTypes
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
&& (current_screen != csSearcher
|
&& (myScreen != mySearcher
|
||||||
|| mySearcher->Main()->Current().first)
|
|| mySearcher->Main()->Current().first)
|
||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
@@ -1793,12 +1561,12 @@ int main(int argc, char *argv[])
|
|||||||
for (size_t i = (myScreen == mySearcher ? SearchEngine::StaticOptions : 0); i < mList->Size(); i++)
|
for (size_t i = (myScreen == mySearcher ? SearchEngine::StaticOptions : 0); i < mList->Size(); i++)
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
switch (current_screen)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
case csPlaylist:
|
|
||||||
name = myPlaylist->Main()->at(i).toString(Config.song_list_format);
|
name = myPlaylist->Main()->at(i).toString(Config.song_list_format);
|
||||||
break;
|
}
|
||||||
case csBrowser:
|
else if (myScreen == myBrowser)
|
||||||
|
{
|
||||||
switch (myBrowser->Main()->at(i).type)
|
switch (myBrowser->Main()->at(i).type)
|
||||||
{
|
{
|
||||||
case itDirectory:
|
case itDirectory:
|
||||||
@@ -1812,26 +1580,30 @@ int main(int argc, char *argv[])
|
|||||||
name += myBrowser->Main()->at(i).name;
|
name += myBrowser->Main()->at(i).name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case csSearcher:
|
else if (myScreen == mySearcher)
|
||||||
|
{
|
||||||
name = mySearcher->Main()->at(i).second->toString(Config.song_list_format);
|
name = mySearcher->Main()->at(i).second->toString(Config.song_list_format);
|
||||||
break;
|
}
|
||||||
case csLibrary:
|
else if (myScreen == myLibrary)
|
||||||
|
{
|
||||||
if (myScreen->Cmp() == myLibrary->Artists)
|
if (myScreen->Cmp() == myLibrary->Artists)
|
||||||
name = myLibrary->Artists->at(i);
|
name = myLibrary->Artists->at(i);
|
||||||
else if (myScreen->Cmp() == myLibrary->Albums)
|
else if (myScreen->Cmp() == myLibrary->Albums)
|
||||||
name = myLibrary->Albums->at(i).first;
|
name = myLibrary->Albums->at(i).first;
|
||||||
else
|
else
|
||||||
name = myLibrary->Songs->at(i).toString(Config.song_library_format);
|
name = myLibrary->Songs->at(i).toString(Config.song_library_format);
|
||||||
break;
|
}
|
||||||
case csPlaylistEditor:
|
else if (myScreen == myPlaylistEditor)
|
||||||
|
{
|
||||||
if (myScreen->Cmp() == myPlaylistEditor->List)
|
if (myScreen->Cmp() == myPlaylistEditor->List)
|
||||||
name = myPlaylistEditor->List->at(i);
|
name = myPlaylistEditor->List->at(i);
|
||||||
else
|
else
|
||||||
name = myPlaylistEditor->Content->at(i).toString(Config.song_list_format);
|
name = myPlaylistEditor->Content->at(i).toString(Config.song_list_format);
|
||||||
break;
|
}
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
case csTagEditor:
|
else if (myScreen == myTagEditor)
|
||||||
|
{
|
||||||
if (myScreen->Cmp() == myTagEditor->LeftColumn)
|
if (myScreen->Cmp() == myTagEditor->LeftColumn)
|
||||||
name = myTagEditor->LeftColumn->at(i).first;
|
name = myTagEditor->LeftColumn->at(i).first;
|
||||||
else
|
else
|
||||||
@@ -1883,11 +1655,8 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
# endif // HAVE_TAGLIB_H
|
||||||
ToLower(name);
|
ToLower(name);
|
||||||
if (name.find(findme) != string::npos && !mList->isStatic(i))
|
if (name.find(findme) != string::npos && !mList->isStatic(i))
|
||||||
{
|
{
|
||||||
@@ -2011,13 +1780,23 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
myLyrics->SwitchTo();
|
myLyrics->SwitchTo();
|
||||||
}
|
}
|
||||||
|
else if (Keypressed(input, Key.Quit))
|
||||||
|
{
|
||||||
|
main_exit = 1;
|
||||||
|
}
|
||||||
|
# ifdef HAVE_TAGLIB_H
|
||||||
|
else if (myScreen == myTinyTagEditor)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
# endif // HAVE_TAGLIB_H
|
||||||
else if (Keypressed(input, Key.Help))
|
else if (Keypressed(input, Key.Help))
|
||||||
{
|
{
|
||||||
myHelp->SwitchTo();
|
myHelp->SwitchTo();
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.ScreenSwitcher))
|
else if (Keypressed(input, Key.ScreenSwitcher))
|
||||||
{
|
{
|
||||||
if (current_screen == csPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
myBrowser->SwitchTo();
|
myBrowser->SwitchTo();
|
||||||
else
|
else
|
||||||
myPlaylist->SwitchTo();
|
myPlaylist->SwitchTo();
|
||||||
@@ -2055,9 +1834,6 @@ int main(int argc, char *argv[])
|
|||||||
myClock->SwitchTo();
|
myClock->SwitchTo();
|
||||||
}
|
}
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
else if (Keypressed(input, Key.Quit))
|
|
||||||
main_exit = 1;
|
|
||||||
|
|
||||||
// key mapping end
|
// key mapping end
|
||||||
}
|
}
|
||||||
// restore old cerr buffer
|
// restore old cerr buffer
|
||||||
|
|||||||
@@ -34,27 +34,27 @@
|
|||||||
|
|
||||||
typedef std::pair<std::string, std::string> string_pair;
|
typedef std::pair<std::string, std::string> string_pair;
|
||||||
|
|
||||||
enum NcmpcppScreen
|
/*enum NcmpcppScreen
|
||||||
{
|
{
|
||||||
csHelp,
|
myHelp,
|
||||||
csPlaylist,
|
myPlaylist,
|
||||||
csBrowser,
|
myBrowser,
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
csTinyTagEditor,
|
myTinyTagEditor,
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
csInfo,
|
myInfo,
|
||||||
csSearcher,
|
mySearcher,
|
||||||
csLibrary,
|
myLibrary,
|
||||||
csLyrics,
|
myLyrics,
|
||||||
csPlaylistEditor,
|
myPlaylistEditor,
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
csTagEditor,
|
myTagEditor,
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
# ifdef ENABLE_CLOCK
|
# ifdef ENABLE_CLOCK
|
||||||
csClock,
|
myClock,
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
csOther
|
csOther
|
||||||
};
|
};*/
|
||||||
|
|
||||||
const int ncmpcpp_window_timeout = 500;
|
const int ncmpcpp_window_timeout = 500;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "status_checker.h"
|
#include "status_checker.h"
|
||||||
|
#include "tag_editor.h"
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@@ -44,20 +45,14 @@ void Playlist::Init()
|
|||||||
|
|
||||||
void Playlist::SwitchTo()
|
void Playlist::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csPlaylist
|
if (myScreen == this)
|
||||||
# ifdef HAVE_TAGLIB_H
|
return;
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = csPlaylist;
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Playlist::Resize()
|
void Playlist::Resize()
|
||||||
{
|
{
|
||||||
@@ -72,21 +67,23 @@ std::string Playlist::Title()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::SpacePressed()
|
|
||||||
{
|
|
||||||
if (w->Empty())
|
|
||||||
return;
|
|
||||||
size_t i = w->Choice();
|
|
||||||
w->Select(i, !w->isSelected(i));
|
|
||||||
w->Scroll(wDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Playlist::EnterPressed()
|
void Playlist::EnterPressed()
|
||||||
{
|
{
|
||||||
if (!w->Empty())
|
if (!w->Empty())
|
||||||
Mpd->PlayID(w->Current().GetID());
|
Mpd->PlayID(w->Current().GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Playlist::SpacePressed()
|
||||||
|
{
|
||||||
|
Select(w);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
MPD::Song *Playlist::CurrentSong()
|
||||||
|
{
|
||||||
|
return !w->Empty() ? &w->Current() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Playlist::TotalLength()
|
std::string Playlist::TotalLength()
|
||||||
{
|
{
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ class Playlist : public Screen< Menu<MPD::Song> >
|
|||||||
virtual void EnterPressed();
|
virtual void EnterPressed();
|
||||||
virtual void SpacePressed();
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
bool isPlaying() { return NowPlaying >= 0 && !w->Empty(); }
|
bool isPlaying() { return NowPlaying >= 0 && !w->Empty(); }
|
||||||
const MPD::Song &NowPlayingSong();
|
const MPD::Song &NowPlayingSong();
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "playlist_editor.h"
|
#include "playlist_editor.h"
|
||||||
#include "mpdpp.h"
|
#include "mpdpp.h"
|
||||||
#include "status_checker.h"
|
#include "status_checker.h"
|
||||||
|
#include "tag_editor.h"
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
using namespace MPD;
|
using namespace MPD;
|
||||||
@@ -91,26 +92,16 @@ void PlaylistEditor::Refresh()
|
|||||||
|
|
||||||
void PlaylistEditor::SwitchTo()
|
void PlaylistEditor::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csPlaylistEditor
|
if (myScreen == this)
|
||||||
# ifdef HAVE_TAGLIB_H
|
return;
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
myScreen = this;
|
||||||
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
||||||
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
myScreen = this;
|
|
||||||
current_screen = csPlaylistEditor;
|
|
||||||
|
|
||||||
UpdateSongList(Content);
|
UpdateSongList(Content);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void PlaylistEditor::Update()
|
void PlaylistEditor::Update()
|
||||||
{
|
{
|
||||||
@@ -271,3 +262,19 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
w->Scroll(wDown);
|
w->Scroll(wDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlaylistEditor::SpacePressed()
|
||||||
|
{
|
||||||
|
if (Config.space_selects && w == Content)
|
||||||
|
{
|
||||||
|
Select(Content);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AddToPlaylist(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
MPD::Song *PlaylistEditor::CurrentSong()
|
||||||
|
{
|
||||||
|
return w == Content && !Content->Empty() ? &Content->Current() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ class PlaylistEditor : public Screen<Window>
|
|||||||
virtual void Update();
|
virtual void Update();
|
||||||
|
|
||||||
virtual void EnterPressed() { AddToPlaylist(1); }
|
virtual void EnterPressed() { AddToPlaylist(1); }
|
||||||
virtual void SpacePressed() { AddToPlaylist(0); }
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
void NextColumn();
|
void NextColumn();
|
||||||
void PrevColumn();
|
void PrevColumn();
|
||||||
|
|||||||
30
src/screen.cpp
Normal file
30
src/screen.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008-2009 by Andrzej Rybczak *
|
||||||
|
* electricityispower@gmail.com *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
|
void BasicScreen::Select(List *l)
|
||||||
|
{
|
||||||
|
if (l->Empty())
|
||||||
|
return;
|
||||||
|
size_t i = l->Choice();
|
||||||
|
l->Select(i, !l->isSelected(i));
|
||||||
|
}
|
||||||
|
|
||||||
@@ -22,6 +22,8 @@
|
|||||||
#define _SCREEN_H
|
#define _SCREEN_H
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "mpdpp.h"
|
||||||
|
|
||||||
class BasicScreen
|
class BasicScreen
|
||||||
{
|
{
|
||||||
@@ -42,6 +44,11 @@ class BasicScreen
|
|||||||
|
|
||||||
virtual void EnterPressed() { }
|
virtual void EnterPressed() { }
|
||||||
virtual void SpacePressed() { }
|
virtual void SpacePressed() { }
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong() { return 0; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void Select(List *);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class WindowType> class Screen : public BasicScreen
|
template <class WindowType> class Screen : public BasicScreen
|
||||||
|
|||||||
@@ -59,27 +59,22 @@ void SearchEngine::Resize()
|
|||||||
|
|
||||||
void SearchEngine::SwitchTo()
|
void SearchEngine::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csSearcher
|
if (myScreen == this)
|
||||||
# ifdef HAVE_TAGLIB_H
|
return;
|
||||||
&& current_screen != csTinyTagEditor
|
|
||||||
# endif // HAVE_TAGLIB_H
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
if (w->Empty())
|
if (w->Empty())
|
||||||
Prepare();
|
Prepare();
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
w->Hide();
|
w->Hide();
|
||||||
current_screen = csSearcher;
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
|
|
||||||
if (!w->Back().first)
|
if (!w->Back().first)
|
||||||
{
|
{
|
||||||
w->WriteXY(0, 0, 0, "Updating list...");
|
w->WriteXY(0, 0, 0, "Updating list...");
|
||||||
UpdateFoundList();
|
UpdateFoundList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::string SearchEngine::Title()
|
std::string SearchEngine::Title()
|
||||||
{
|
{
|
||||||
@@ -254,6 +249,13 @@ void SearchEngine::SpacePressed()
|
|||||||
if (w->Current().first)
|
if (w->Current().first)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Config.space_selects)
|
||||||
|
{
|
||||||
|
Select(w);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
block_item_list_update = 1;
|
block_item_list_update = 1;
|
||||||
if (Config.ncmpc_like_songs_adding && w->isBold())
|
if (Config.ncmpc_like_songs_adding && w->isBold())
|
||||||
{
|
{
|
||||||
@@ -283,6 +285,11 @@ void SearchEngine::SpacePressed()
|
|||||||
w->Scroll(wDown);
|
w->Scroll(wDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPD::Song *SearchEngine::CurrentSong()
|
||||||
|
{
|
||||||
|
return !w->Empty() ? w->Current().second : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void SearchEngine::UpdateFoundList()
|
void SearchEngine::UpdateFoundList()
|
||||||
{
|
{
|
||||||
bool bold = 0;
|
bool bold = 0;
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ class SearchEngine : public Screen < Menu< std::pair<Buffer *, MPD::Song *> > >
|
|||||||
virtual void EnterPressed();
|
virtual void EnterPressed();
|
||||||
virtual void SpacePressed();
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
void UpdateFoundList();
|
void UpdateFoundList();
|
||||||
|
|
||||||
static size_t StaticOptions;
|
static size_t StaticOptions;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void TraceMpdStatus()
|
|||||||
Mpd->UpdateStatus();
|
Mpd->UpdateStatus();
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
if (current_screen == csPlaylist && now == timer+Config.playlist_disable_highlight_delay)
|
if (myScreen == myPlaylist && now == timer+Config.playlist_disable_highlight_delay)
|
||||||
myPlaylist->Main()->Highlighting(!Config.playlist_disable_highlight_delay);
|
myPlaylist->Main()->Highlighting(!Config.playlist_disable_highlight_delay);
|
||||||
|
|
||||||
if (lock_statusbar_delay > 0)
|
if (lock_statusbar_delay > 0)
|
||||||
@@ -167,7 +167,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
{
|
{
|
||||||
if (playlist_length < myPlaylist->Main()->Size())
|
if (playlist_length < myPlaylist->Main()->Size())
|
||||||
{
|
{
|
||||||
myPlaylist->Main()->Clear(playlist_length < myPlaylist->Main()->GetHeight() && current_screen == csPlaylist);
|
myPlaylist->Main()->Clear(playlist_length < myPlaylist->Main()->GetHeight() && myScreen == myPlaylist);
|
||||||
Mpd->GetPlaylistChanges(-1, list);
|
Mpd->GetPlaylistChanges(-1, list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -191,7 +191,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
(*it)->NullMe();
|
(*it)->NullMe();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_screen == csPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
if (!playlist_length || myPlaylist->Main()->Size() < myPlaylist->Main()->GetHeight())
|
if (!playlist_length || myPlaylist->Main()->Size() < myPlaylist->Main()->GetHeight())
|
||||||
myPlaylist->Main()->Window::Clear();
|
myPlaylist->Main()->Window::Clear();
|
||||||
@@ -215,7 +215,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_screen == csPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
|
|
||||||
if (myPlaylist->Main()->Empty())
|
if (myPlaylist->Main()->Empty())
|
||||||
@@ -226,19 +226,19 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
|
|
||||||
if (!block_item_list_update)
|
if (!block_item_list_update)
|
||||||
{
|
{
|
||||||
if (current_screen == csBrowser)
|
if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
myBrowser->UpdateItemList();
|
myBrowser->UpdateItemList();
|
||||||
}
|
}
|
||||||
else if (current_screen == csSearcher)
|
else if (myScreen == mySearcher)
|
||||||
{
|
{
|
||||||
mySearcher->UpdateFoundList();
|
mySearcher->UpdateFoundList();
|
||||||
}
|
}
|
||||||
else if (current_screen == csLibrary)
|
else if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
UpdateSongList(myLibrary->Songs);
|
UpdateSongList(myLibrary->Songs);
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
UpdateSongList(myPlaylistEditor->Content);
|
UpdateSongList(myPlaylistEditor->Content);
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
if (!Mpd->GetElapsedTime())
|
if (!Mpd->GetElapsedTime())
|
||||||
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
||||||
|
|
||||||
if (Config.now_playing_lyrics && !Config.repeat_one_mode && current_screen == csLyrics && prev_screen == csPlaylist)
|
if (Config.now_playing_lyrics && !Config.repeat_one_mode && myScreen == myLyrics && myOldScreen == myPlaylist)
|
||||||
Lyrics::Reload = 1;
|
Lyrics::Reload = 1;
|
||||||
}
|
}
|
||||||
playing_song_scroll_begin = 0;
|
playing_song_scroll_begin = 0;
|
||||||
@@ -455,7 +455,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
wHeader->SetColor(Config.header_color);
|
wHeader->SetColor(Config.header_color);
|
||||||
wHeader->Refresh();
|
wHeader->Refresh();
|
||||||
}
|
}
|
||||||
if (current_screen == csPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
myPlaylist->Main()->Refresh();
|
myPlaylist->Main()->Refresh();
|
||||||
wFooter->Bold(0);
|
wFooter->Bold(0);
|
||||||
wFooter->GotoXY(sx, sy);
|
wFooter->GotoXY(sx, sy);
|
||||||
|
|||||||
@@ -60,31 +60,6 @@ void TinyTagEditor::Resize()
|
|||||||
|
|
||||||
void TinyTagEditor::SwitchTo()
|
void TinyTagEditor::SwitchTo()
|
||||||
{
|
{
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(((Screen<Window> *)myScreen)->Main());
|
|
||||||
size_t id = mList->Choice();
|
|
||||||
switch (current_screen)
|
|
||||||
{
|
|
||||||
case csPlaylist:
|
|
||||||
itsEdited = myPlaylist->Main()->at(id);
|
|
||||||
break;
|
|
||||||
case csBrowser:
|
|
||||||
itsEdited = *myBrowser->Main()->at(id).song;
|
|
||||||
break;
|
|
||||||
case csSearcher:
|
|
||||||
itsEdited = *mySearcher->Main()->at(id).second;
|
|
||||||
break;
|
|
||||||
case csLibrary:
|
|
||||||
itsEdited = myLibrary->Songs->at(id);
|
|
||||||
break;
|
|
||||||
case csPlaylistEditor:
|
|
||||||
itsEdited = myPlaylistEditor->Content->at(id);
|
|
||||||
break;
|
|
||||||
case csTagEditor:
|
|
||||||
itsEdited = myTagEditor->Tags->at(id);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (itsEdited.IsStream())
|
if (itsEdited.IsStream())
|
||||||
{
|
{
|
||||||
ShowMessage("Cannot edit streams!");
|
ShowMessage("Cannot edit streams!");
|
||||||
@@ -93,8 +68,6 @@ void TinyTagEditor::SwitchTo()
|
|||||||
{
|
{
|
||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
|
||||||
current_screen = csTinyTagEditor;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -216,7 +189,7 @@ void TinyTagEditor::EnterPressed()
|
|||||||
if (s.IsFromDB())
|
if (s.IsFromDB())
|
||||||
{
|
{
|
||||||
Mpd->UpdateDirectory(locale_to_utf_cpy(s.GetDirectory()));
|
Mpd->UpdateDirectory(locale_to_utf_cpy(s.GetDirectory()));
|
||||||
if (prev_screen == csSearcher)
|
if (myOldScreen == mySearcher)
|
||||||
*mySearcher->Main()->Current().second = s;
|
*mySearcher->Main()->Current().second = s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -234,17 +207,16 @@ void TinyTagEditor::EnterPressed()
|
|||||||
{
|
{
|
||||||
w->Clear();
|
w->Clear();
|
||||||
myScreen = myOldScreen;
|
myScreen = myOldScreen;
|
||||||
current_screen = prev_screen;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
if (myScreen == myLibrary)
|
||||||
{
|
{
|
||||||
myLibrary->Refresh();
|
myLibrary->Refresh();
|
||||||
}
|
}
|
||||||
else if (current_screen == csPlaylistEditor)
|
else if (myScreen == myPlaylistEditor)
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Refresh();
|
myPlaylistEditor->Refresh();
|
||||||
}
|
}
|
||||||
else if (current_screen == csTagEditor)
|
else if (myScreen == myTagEditor)
|
||||||
{
|
{
|
||||||
myTagEditor->Refresh();
|
myTagEditor->Refresh();
|
||||||
}
|
}
|
||||||
@@ -254,6 +226,14 @@ void TinyTagEditor::EnterPressed()
|
|||||||
UnlockStatusbar();
|
UnlockStatusbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TinyTagEditor::SetEdited(MPD::Song *s)
|
||||||
|
{
|
||||||
|
if (!s)
|
||||||
|
return false;
|
||||||
|
itsEdited = *s;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool TinyTagEditor::GetTags()
|
bool TinyTagEditor::GetTags()
|
||||||
{
|
{
|
||||||
Song &s = itsEdited;
|
Song &s = itsEdited;
|
||||||
@@ -316,13 +296,6 @@ bool TinyTagEditor::GetTags()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Window *Global::wTagEditorActiveCol;
|
|
||||||
/*Menu<string_pair> *Global::Albums;
|
|
||||||
Menu<string_pair> *Global::Dirs;
|
|
||||||
Menu<string_pair> *Global::LeftColumn;
|
|
||||||
Menu<string> *Global::TagTypes;
|
|
||||||
Menu<Song> *Global::Tags;*/
|
|
||||||
|
|
||||||
TagEditor *myTagEditor = new TagEditor;
|
TagEditor *myTagEditor = new TagEditor;
|
||||||
|
|
||||||
const size_t TagEditor::MiddleColumnWidth = 26;
|
const size_t TagEditor::MiddleColumnWidth = 26;
|
||||||
@@ -388,15 +361,15 @@ std::string TagEditor::Title()
|
|||||||
|
|
||||||
void TagEditor::SwitchTo()
|
void TagEditor::SwitchTo()
|
||||||
{
|
{
|
||||||
if (current_screen != csTagEditor && current_screen != csTinyTagEditor)
|
if (myScreen == this)
|
||||||
{
|
return;
|
||||||
|
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
|
myScreen = this;
|
||||||
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
myPlaylist->Main()->Hide(); // hack, should be myScreen, but it doesn't always have 100% width
|
||||||
|
|
||||||
// redraw_screen = 1;
|
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
TagEditor::Refresh();
|
Refresh();
|
||||||
|
|
||||||
if (TagTypes->Empty())
|
if (TagTypes->Empty())
|
||||||
{
|
{
|
||||||
@@ -421,10 +394,6 @@ void TagEditor::SwitchTo()
|
|||||||
TagTypes->AddOption("Capitalize First Letters");
|
TagTypes->AddOption("Capitalize First Letters");
|
||||||
TagTypes->AddOption("lower all letters");
|
TagTypes->AddOption("lower all letters");
|
||||||
}
|
}
|
||||||
|
|
||||||
myScreen = this;
|
|
||||||
current_screen = csTagEditor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagEditor::Refresh()
|
void TagEditor::Refresh()
|
||||||
@@ -644,10 +613,8 @@ void TagEditor::EnterPressed()
|
|||||||
{
|
{
|
||||||
if (w == TagTypes)
|
if (w == TagTypes)
|
||||||
{
|
{
|
||||||
current_screen = csOther;
|
|
||||||
DealWithFilenames(list);
|
DealWithFilenames(list);
|
||||||
current_screen = csTagEditor;
|
Refresh();
|
||||||
TagEditor::Refresh();
|
|
||||||
}
|
}
|
||||||
else if (w == Tags)
|
else if (w == Tags)
|
||||||
{
|
{
|
||||||
@@ -743,6 +710,12 @@ void TagEditor::EnterPressed()
|
|||||||
|
|
||||||
void TagEditor::SpacePressed()
|
void TagEditor::SpacePressed()
|
||||||
{
|
{
|
||||||
|
if (w == Tags)
|
||||||
|
{
|
||||||
|
Select(Tags);
|
||||||
|
w->Scroll(wDown);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (w != LeftColumn)
|
if (w != LeftColumn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -753,6 +726,11 @@ void TagEditor::SpacePressed()
|
|||||||
Tags->Clear(0);
|
Tags->Clear(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPD::Song *TagEditor::CurrentSong()
|
||||||
|
{
|
||||||
|
return w == Tags && !Tags->Empty() ? &Tags->Current() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void TagEditor::NextColumn()
|
void TagEditor::NextColumn()
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ class TinyTagEditor : public Screen< Menu<Buffer> >
|
|||||||
|
|
||||||
virtual void EnterPressed();
|
virtual void EnterPressed();
|
||||||
|
|
||||||
|
bool SetEdited(MPD::Song *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool GetTags();
|
bool GetTags();
|
||||||
MPD::Song itsEdited;
|
MPD::Song itsEdited;
|
||||||
@@ -66,6 +68,8 @@ class TagEditor : public Screen<Window>
|
|||||||
virtual void EnterPressed();
|
virtual void EnterPressed();
|
||||||
virtual void SpacePressed();
|
virtual void SpacePressed();
|
||||||
|
|
||||||
|
virtual MPD::Song *CurrentSong();
|
||||||
|
|
||||||
void NextColumn();
|
void NextColumn();
|
||||||
void PrevColumn();
|
void PrevColumn();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user