change wCurrent and wPrev to myScreen
This commit is contained in:
@@ -65,8 +65,8 @@ void Browser::SwitchTo()
|
|||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
|
w->Empty() ? myBrowser->GetDirectory(itsBrowsedDir) : myBrowser->UpdateItemList();
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = csBrowser;
|
current_screen = csBrowser;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void Clock::SwitchTo()
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
myPlaylist->Main()->Hide();
|
myPlaylist->Main()->Hide();
|
||||||
current_screen = csClock;
|
current_screen = csClock;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
@@ -97,7 +97,7 @@ std::string Clock::Title()
|
|||||||
void Clock::Update()
|
void Clock::Update()
|
||||||
{
|
{
|
||||||
if (Width > size_t(COLS) || Height > main_height)
|
if (Width > size_t(COLS) || Height > main_height)
|
||||||
return;
|
myPlaylist->SwitchTo();
|
||||||
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ncmpcpp.h"
|
#include "ncmpcpp.h"
|
||||||
#include "mpdpp.h"
|
#include "mpdpp.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
/// FIXME: this is absolutely shitty, I need to get rid of this.
|
/// FIXME: this is absolutely shitty, I need to get rid of this.
|
||||||
|
|
||||||
@@ -32,8 +33,8 @@ namespace Global
|
|||||||
extern ncmpcpp_config Config;
|
extern ncmpcpp_config Config;
|
||||||
extern ncmpcpp_keys Key;
|
extern ncmpcpp_keys Key;
|
||||||
|
|
||||||
extern Window *wCurrent;
|
extern BasicScreen *myScreen;
|
||||||
extern Window *wPrev;
|
extern BasicScreen *myOldScreen;
|
||||||
|
|
||||||
// extern Menu<MPD::Song> *myPlaylist->Main();
|
// extern Menu<MPD::Song> *myPlaylist->Main();
|
||||||
// extern Menu<MPD::Item> *myBrowser->Main();
|
// extern Menu<MPD::Item> *myBrowser->Main();
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ void Help::SwitchTo()
|
|||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = csHelp;
|
current_screen = csHelp;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/info.cpp
54
src/info.cpp
@@ -81,11 +81,11 @@ void Info::Update()
|
|||||||
|
|
||||||
void Info::GetSong()
|
void Info::GetSong()
|
||||||
{
|
{
|
||||||
if (wCurrent == w)
|
if (myScreen == this)
|
||||||
{
|
{
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
current_screen = prev_screen;
|
||||||
wCurrent = wPrev;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary)
|
||||||
@@ -104,18 +104,18 @@ void Info::GetSong()
|
|||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(wCurrent == myPlaylist->Main() && !myPlaylist->Main()->Empty())
|
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
|| (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == MPD::itSong)
|
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| (wCurrent == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
||||||
|| (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| (wCurrent == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MPD::Song *s = 0;
|
MPD::Song *s = 0;
|
||||||
size_t id = ((Menu<MPD::Song> *)wCurrent)->Choice();
|
size_t id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
case csPlaylist:
|
case csPlaylist:
|
||||||
@@ -141,8 +141,8 @@ void Info::GetSong()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wPrev = wCurrent;
|
myOldScreen = myScreen;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
prev_screen = current_screen;
|
||||||
current_screen = csInfo;
|
current_screen = csInfo;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
@@ -158,11 +158,11 @@ void Info::GetSong()
|
|||||||
|
|
||||||
void Info::GetArtist()
|
void Info::GetArtist()
|
||||||
{
|
{
|
||||||
if (wCurrent == w)
|
if (myScreen == this)
|
||||||
{
|
{
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
current_screen = prev_screen;
|
||||||
wCurrent = wPrev;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary)
|
||||||
@@ -181,14 +181,14 @@ void Info::GetArtist()
|
|||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(wCurrent == myPlaylist->Main() && !myPlaylist->Main()->Empty())
|
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
|| (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == MPD::itSong)
|
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| (wCurrent == myLibrary->Artists && !myLibrary->Artists->Empty())
|
|| (myScreen->Cmp() == myLibrary->Artists && !myLibrary->Artists->Empty())
|
||||||
|| (wCurrent == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
||||||
|| (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| (wCurrent == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ void Info::GetArtist()
|
|||||||
Update();
|
Update();
|
||||||
|
|
||||||
string *artist = new string();
|
string *artist = new string();
|
||||||
int id = ((Menu<MPD::Song> *)wCurrent)->Choice();
|
size_t id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
case csPlaylist:
|
case csPlaylist:
|
||||||
@@ -219,18 +219,18 @@ void Info::GetArtist()
|
|||||||
case csPlaylistEditor:
|
case csPlaylistEditor:
|
||||||
*artist = myPlaylistEditor->Content->at(id).GetArtist();
|
*artist = myPlaylistEditor->Content->at(id).GetArtist();
|
||||||
break;
|
break;
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
case csTagEditor:
|
case csTagEditor:
|
||||||
*artist = myTagEditor->Tags->at(id).GetArtist();
|
*artist = myTagEditor->Tags->at(id).GetArtist();
|
||||||
break;
|
break;
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!artist->empty())
|
if (!artist->empty())
|
||||||
{
|
{
|
||||||
wPrev = wCurrent;
|
myOldScreen = myScreen;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
prev_screen = current_screen;
|
||||||
current_screen = csInfo;
|
current_screen = csInfo;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ void Lyrics::Update()
|
|||||||
|
|
||||||
void Lyrics::SwitchTo()
|
void Lyrics::SwitchTo()
|
||||||
{
|
{
|
||||||
if (wCurrent == w && !Reload)
|
if (myScreen == this && !Reload)
|
||||||
{
|
{
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = prev_screen;
|
current_screen = prev_screen;
|
||||||
wCurrent = wPrev;
|
myScreen = myOldScreen;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary)
|
||||||
@@ -108,13 +108,13 @@ void Lyrics::SwitchTo()
|
|||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
Reload
|
Reload
|
||||||
|| (wCurrent == myPlaylist->Main() && !myPlaylist->Main()->Empty())
|
|| (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
|| (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == MPD::itSong)
|
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == MPD::itSong)
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| (wCurrent == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
||||||
|| (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| (wCurrent == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -137,12 +137,12 @@ void Lyrics::SwitchTo()
|
|||||||
if (Reload)
|
if (Reload)
|
||||||
{
|
{
|
||||||
current_screen = csPlaylist;
|
current_screen = csPlaylist;
|
||||||
wCurrent = myPlaylist->Main();
|
myScreen = myPlaylist;
|
||||||
Reload = 0;
|
Reload = 0;
|
||||||
id = myPlaylist->NowPlaying;
|
id = myPlaylist->NowPlaying;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
id = ((Menu<MPD::Song> *)wCurrent)->Choice();
|
id = reinterpret_cast<Menu<MPD::Song> *>(((Screen<Window> *)myScreen)->Main())->Choice();
|
||||||
|
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
@@ -173,9 +173,9 @@ void Lyrics::SwitchTo()
|
|||||||
{
|
{
|
||||||
itsScrollBegin = 0;
|
itsScrollBegin = 0;
|
||||||
itsSong = *s;
|
itsSong = *s;
|
||||||
wPrev = wCurrent;
|
myOldScreen = myScreen;
|
||||||
prev_screen = current_screen;
|
prev_screen = current_screen;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
current_screen = csLyrics;
|
current_screen = csLyrics;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
w->Clear();
|
w->Clear();
|
||||||
|
|||||||
@@ -111,13 +111,13 @@ void MediaLibrary::SwitchTo()
|
|||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
myPlaylist->Main()->Hide(); // hack, should be wCurrent, 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_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
MediaLibrary::Refresh();
|
MediaLibrary::Refresh();
|
||||||
|
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
current_screen = csLibrary;
|
current_screen = csLibrary;
|
||||||
|
|
||||||
UpdateSongList(Songs);
|
UpdateSongList(Songs);
|
||||||
@@ -202,11 +202,11 @@ void MediaLibrary::Update()
|
|||||||
Albums->Refresh();
|
Albums->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Artists->Empty() && wCurrent == Albums && Albums->Empty())
|
if (!Artists->Empty() && myScreen->Cmp() == Albums && Albums->Empty())
|
||||||
{
|
{
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
Artists->HighlightColor(Config.active_column_color);
|
Artists->HighlightColor(Config.active_column_color);
|
||||||
wCurrent = w = Artists;
|
w = Artists;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Artists->Empty() && Songs->Empty())
|
if (!Artists->Empty() && Songs->Empty())
|
||||||
@@ -257,7 +257,7 @@ void MediaLibrary::NextColumn()
|
|||||||
return;
|
return;
|
||||||
Artists->HighlightColor(Config.main_highlight_color);
|
Artists->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = Albums;
|
w = Albums;
|
||||||
Albums->HighlightColor(Config.active_column_color);
|
Albums->HighlightColor(Config.active_column_color);
|
||||||
if (!Albums->Empty())
|
if (!Albums->Empty())
|
||||||
return;
|
return;
|
||||||
@@ -266,7 +266,7 @@ void MediaLibrary::NextColumn()
|
|||||||
{
|
{
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = Songs;
|
w = Songs;
|
||||||
Songs->HighlightColor(Config.active_column_color);
|
Songs->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ void MediaLibrary::PrevColumn()
|
|||||||
{
|
{
|
||||||
Songs->HighlightColor(Config.main_highlight_color);
|
Songs->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = Albums;
|
w = Albums;
|
||||||
Albums->HighlightColor(Config.active_column_color);
|
Albums->HighlightColor(Config.active_column_color);
|
||||||
if (!Albums->Empty())
|
if (!Albums->Empty())
|
||||||
return;
|
return;
|
||||||
@@ -287,7 +287,7 @@ void MediaLibrary::PrevColumn()
|
|||||||
{
|
{
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = Artists;
|
w = Artists;
|
||||||
Artists->HighlightColor(Config.active_column_color);
|
Artists->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
{
|
{
|
||||||
SongList list;
|
SongList list;
|
||||||
|
|
||||||
if (!Artists->Empty() && wCurrent == Artists)
|
if (!Artists->Empty() && w == Artists)
|
||||||
{
|
{
|
||||||
Mpd->StartSearch(1);
|
Mpd->StartSearch(1);
|
||||||
Mpd->AddSearch(Config.media_lib_primary_tag, locale_to_utf_cpy(Artists->Current()));
|
Mpd->AddSearch(Config.media_lib_primary_tag, locale_to_utf_cpy(Artists->Current()));
|
||||||
@@ -318,7 +318,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
ShowMessage("%s", message_part_of_songs_added);
|
ShowMessage("%s", message_part_of_songs_added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wCurrent == Albums)
|
else if (w == Albums)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Songs->Size(); i++)
|
for (size_t i = 0; i < Songs->Size(); i++)
|
||||||
Mpd->QueueAddSong(Songs->at(i));
|
Mpd->QueueAddSong(Songs->at(i));
|
||||||
@@ -335,7 +335,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
ShowMessage("%s", message_part_of_songs_added);
|
ShowMessage("%s", message_part_of_songs_added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wCurrent == Songs)
|
else if (w == Songs)
|
||||||
{
|
{
|
||||||
if (!Songs->Empty())
|
if (!Songs->Empty())
|
||||||
{
|
{
|
||||||
@@ -387,13 +387,13 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
if (!add_n_play)
|
if (!add_n_play)
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wDown);
|
w->Scroll(wDown);
|
||||||
if (wCurrent == Artists)
|
if (w == Artists)
|
||||||
{
|
{
|
||||||
Albums->Clear(0);
|
Albums->Clear(0);
|
||||||
Songs->Clear(0);
|
Songs->Clear(0);
|
||||||
}
|
}
|
||||||
else if (wCurrent == Albums)
|
else if (w == Albums)
|
||||||
Songs->Clear(0);
|
Songs->Clear(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
209
src/ncmpcpp.cpp
209
src/ncmpcpp.cpp
@@ -63,8 +63,8 @@ using std::vector;
|
|||||||
ncmpcpp_config Global::Config;
|
ncmpcpp_config Global::Config;
|
||||||
ncmpcpp_keys Global::Key;
|
ncmpcpp_keys Global::Key;
|
||||||
|
|
||||||
Window *Global::wCurrent;
|
BasicScreen *Global::myScreen;
|
||||||
Window *Global::wPrev;
|
BasicScreen *Global::myOldScreen;
|
||||||
|
|
||||||
Window *Global::wHeader;
|
Window *Global::wHeader;
|
||||||
Window *Global::wFooter;
|
Window *Global::wFooter;
|
||||||
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->SetGetStringHelper(TraceMpdStatus);
|
wFooter->SetGetStringHelper(TraceMpdStatus);
|
||||||
wFooter->Display();
|
wFooter->Display();
|
||||||
|
|
||||||
wCurrent = myPlaylist->Main();
|
myScreen = myPlaylist;
|
||||||
current_screen = csPlaylist;
|
current_screen = csPlaylist;
|
||||||
|
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
@@ -201,6 +201,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
gettimeofday(&now, 0);
|
gettimeofday(&now, 0);
|
||||||
|
|
||||||
|
// this type of casting is absolutely hillarious lol
|
||||||
|
Screen<Window> *&myWindow = *(Screen<Window> **)(void *)&myScreen;
|
||||||
|
|
||||||
while (!main_exit)
|
while (!main_exit)
|
||||||
{
|
{
|
||||||
if (!Mpd->Connected())
|
if (!Mpd->Connected())
|
||||||
@@ -337,10 +340,10 @@ int main(int argc, char *argv[])
|
|||||||
myInfo->Update();
|
myInfo->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
wCurrent->Display();
|
myWindow->Main()->Display();
|
||||||
// redraw_screen = 0;
|
// redraw_screen = 0;
|
||||||
|
|
||||||
wCurrent->ReadKey(input);
|
myWindow->Main()->ReadKey(input);
|
||||||
if (input == ERR)
|
if (input == ERR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -362,26 +365,26 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
if (wCurrent == myLibrary->Artists)
|
if (myScreen->Cmp() == myLibrary->Artists)
|
||||||
{
|
{
|
||||||
myLibrary->Albums->Clear(0);
|
myLibrary->Albums->Clear(0);
|
||||||
myLibrary->Songs->Clear(0);
|
myLibrary->Songs->Clear(0);
|
||||||
}
|
}
|
||||||
else if (wCurrent == myLibrary->Albums)
|
else if (myScreen->Cmp() == myLibrary->Albums)
|
||||||
{
|
{
|
||||||
myLibrary->Songs->Clear(0);
|
myLibrary->Songs->Clear(0);
|
||||||
}
|
}
|
||||||
else if (wCurrent == myPlaylistEditor->List)
|
else if (myScreen->Cmp() == myPlaylistEditor->List)
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Content->Clear(0);
|
myPlaylistEditor->Content->Clear(0);
|
||||||
}
|
}
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
else if (wCurrent == myTagEditor->LeftColumn)
|
else if (myScreen->Cmp() == myTagEditor->LeftColumn)
|
||||||
{
|
{
|
||||||
myTagEditor->Tags->Clear(0);
|
myTagEditor->Tags->Clear(0);
|
||||||
myTagEditor->TagTypes->Refresh();
|
myTagEditor->TagTypes->Refresh();
|
||||||
}
|
}
|
||||||
// else if (wCurrent == myTagEditor->TagTypes)
|
// else if (myScreen == myTagEditor->TagTypes)
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
}
|
}
|
||||||
@@ -400,25 +403,25 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!Config.fancy_scrolling
|
if (!Config.fancy_scrolling
|
||||||
&& (wCurrent == myLibrary->Artists
|
&& (myScreen->Cmp() == myLibrary->Artists
|
||||||
|| wCurrent == myPlaylistEditor->List
|
|| myScreen->Cmp() == myPlaylistEditor->List
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->LeftColumn
|
|| myScreen->Cmp() == myTagEditor->LeftColumn
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wCurrent->SetTimeout(50);
|
myWindow->Main()->SetTimeout(50);
|
||||||
while (Keypressed(input, Key.Up))
|
while (Keypressed(input, Key.Up))
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wUp);
|
myWindow->Main()->Scroll(wUp);
|
||||||
wCurrent->Refresh();
|
myWindow->Main()->Refresh();
|
||||||
wCurrent->ReadKey(input);
|
myWindow->Main()->ReadKey(input);
|
||||||
}
|
}
|
||||||
wCurrent->SetTimeout(ncmpcpp_window_timeout);
|
myWindow->Main()->SetTimeout(ncmpcpp_window_timeout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wCurrent->Scroll(wUp);
|
myWindow->Main()->Scroll(wUp);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.Down)
|
Keypressed(input, Key.Down)
|
||||||
@@ -428,25 +431,25 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!Config.fancy_scrolling
|
if (!Config.fancy_scrolling
|
||||||
&& (wCurrent == myLibrary->Artists
|
&& (myScreen->Cmp() == myLibrary->Artists
|
||||||
|| wCurrent == myPlaylistEditor->List
|
|| myScreen->Cmp() == myPlaylistEditor->List
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->LeftColumn
|
|| myScreen->Cmp() == myTagEditor->LeftColumn
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wCurrent->SetTimeout(50);
|
myWindow->Main()->SetTimeout(50);
|
||||||
while (Keypressed(input, Key.Down))
|
while (Keypressed(input, Key.Down))
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wDown);
|
myWindow->Main()->Scroll(wDown);
|
||||||
wCurrent->Refresh();
|
myWindow->Main()->Refresh();
|
||||||
wCurrent->ReadKey(input);
|
myWindow->Main()->ReadKey(input);
|
||||||
}
|
}
|
||||||
wCurrent->SetTimeout(ncmpcpp_window_timeout);
|
myWindow->Main()->SetTimeout(ncmpcpp_window_timeout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wCurrent->Scroll(wDown);
|
myWindow->Main()->Scroll(wDown);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.PageUp)
|
Keypressed(input, Key.PageUp)
|
||||||
@@ -455,7 +458,7 @@ int main(int argc, char *argv[])
|
|||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wPageUp);
|
myWindow->Main()->Scroll(wPageUp);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
Keypressed(input, Key.PageDown)
|
Keypressed(input, Key.PageDown)
|
||||||
@@ -464,15 +467,15 @@ int main(int argc, char *argv[])
|
|||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wPageDown);
|
myWindow->Main()->Scroll(wPageDown);
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.Home))
|
else if (Keypressed(input, Key.Home))
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wHome);
|
myWindow->Main()->Scroll(wHome);
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.End))
|
else if (Keypressed(input, Key.End))
|
||||||
{
|
{
|
||||||
wCurrent->Scroll(wEnd);
|
myWindow->Main()->Scroll(wEnd);
|
||||||
}
|
}
|
||||||
else if (input == KEY_RESIZE)
|
else if (input == KEY_RESIZE)
|
||||||
{
|
{
|
||||||
@@ -545,7 +548,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.GoToParentDir))
|
else if (Keypressed(input, Key.GoToParentDir))
|
||||||
{
|
{
|
||||||
if (wCurrent == myBrowser->Main() && myBrowser->CurrentDir() != "/")
|
if (myScreen == myBrowser && myBrowser->CurrentDir() != "/")
|
||||||
{
|
{
|
||||||
myBrowser->Main()->Reset();
|
myBrowser->Main()->Reset();
|
||||||
myBrowser->EnterPressed();
|
myBrowser->EnterPressed();
|
||||||
@@ -601,26 +604,26 @@ int main(int argc, char *argv[])
|
|||||||
else if (Keypressed(input, Key.Space))
|
else if (Keypressed(input, Key.Space))
|
||||||
{
|
{
|
||||||
if (Config.space_selects
|
if (Config.space_selects
|
||||||
|| wCurrent == myPlaylist->Main()
|
|| myScreen == myPlaylist
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->Tags
|
|| myScreen->Cmp() == myTagEditor->Tags
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (wCurrent == myPlaylist->Main()
|
if (myScreen == myPlaylist
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->Tags
|
|| myScreen->Cmp() == myTagEditor->Tags
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
|| (wCurrent == myBrowser->Main() && ((Menu<Song> *)wCurrent)->Choice() >= (myBrowser->CurrentDir() != "/" ? 1 : 0)) || (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == myBrowser && ((Menu<Song> *)myWindow->Main())->Choice() >= (myBrowser->CurrentDir() != "/" ? 1 : 0)) || (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| wCurrent == myLibrary->Songs
|
|| myScreen->Cmp() == myLibrary->Songs
|
||||||
|| wCurrent == myPlaylistEditor->Content)
|
|| myScreen->Cmp() == myPlaylistEditor->Content)
|
||||||
{
|
{
|
||||||
List *mList = (Menu<Song> *)wCurrent;
|
List *mList = (Menu<Song> *)myWindow->Main();
|
||||||
if (mList->Empty())
|
if (mList->Empty())
|
||||||
continue;
|
continue;
|
||||||
size_t i = mList->Choice();
|
size_t i = mList->Choice();
|
||||||
mList->Select(i, !mList->isSelected(i));
|
mList->Select(i, !mList->isSelected(i));
|
||||||
wCurrent->Scroll(wDown);
|
myWindow->Main()->Scroll(wDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -730,10 +733,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Mpd->CommitQueue();
|
Mpd->CommitQueue();
|
||||||
}
|
}
|
||||||
else if (current_screen == csBrowser || wCurrent == myPlaylistEditor->List)
|
else if (current_screen == csBrowser || myScreen->Cmp() == myPlaylistEditor->List)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
string name = wCurrent == myBrowser->Main() ? 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 (current_screen != csBrowser || myBrowser->Main()->Current().type == itPlaylist)
|
||||||
{
|
{
|
||||||
Statusbar() << "Delete playlist " << name << " ? [y/n] ";
|
Statusbar() << "Delete playlist " << name << " ? [y/n] ";
|
||||||
@@ -759,7 +762,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
UnlockStatusbar();
|
UnlockStatusbar();
|
||||||
}
|
}
|
||||||
else if (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
else if (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
{
|
{
|
||||||
if (myPlaylistEditor->Content->hasSelected())
|
if (myPlaylistEditor->Content->hasSelected())
|
||||||
{
|
{
|
||||||
@@ -915,7 +918,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);
|
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);
|
||||||
}
|
}
|
||||||
else if (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
else if (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Content->SetTimeout(50);
|
myPlaylistEditor->Content->SetTimeout(50);
|
||||||
if (myPlaylistEditor->Content->hasSelected())
|
if (myPlaylistEditor->Content->hasSelected())
|
||||||
@@ -1019,7 +1022,7 @@ int main(int argc, char *argv[])
|
|||||||
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);
|
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
else if (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
{
|
{
|
||||||
myPlaylistEditor->Content->SetTimeout(50);
|
myPlaylistEditor->Content->SetTimeout(50);
|
||||||
if (myPlaylistEditor->Content->hasSelected())
|
if (myPlaylistEditor->Content->hasSelected())
|
||||||
@@ -1151,7 +1154,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.ToggleDisplayMode))
|
else if (Keypressed(input, Key.ToggleDisplayMode))
|
||||||
{
|
{
|
||||||
if (wCurrent == myPlaylist->Main())
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
Config.columns_in_playlist = !Config.columns_in_playlist;
|
Config.columns_in_playlist = !Config.columns_in_playlist;
|
||||||
ShowMessage("Playlist display mode: %s", Config.columns_in_playlist ? "Columns" : "Classic");
|
ShowMessage("Playlist display mode: %s", Config.columns_in_playlist ? "Columns" : "Classic");
|
||||||
@@ -1159,13 +1162,13 @@ int main(int argc, char *argv[])
|
|||||||
myPlaylist->Main()->SetItemDisplayerUserData(Config.columns_in_playlist ? &Config.song_columns_list_format : &Config.song_list_format);
|
myPlaylist->Main()->SetItemDisplayerUserData(Config.columns_in_playlist ? &Config.song_columns_list_format : &Config.song_list_format);
|
||||||
myPlaylist->Main()->SetTitle(Config.columns_in_playlist ? Display::Columns(Config.song_columns_list_format) : "");
|
myPlaylist->Main()->SetTitle(Config.columns_in_playlist ? Display::Columns(Config.song_columns_list_format) : "");
|
||||||
}
|
}
|
||||||
else if (wCurrent == myBrowser->Main())
|
else if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
Config.columns_in_browser = !Config.columns_in_browser;
|
Config.columns_in_browser = !Config.columns_in_browser;
|
||||||
ShowMessage("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic");
|
ShowMessage("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic");
|
||||||
myBrowser->Main()->SetTitle(Config.columns_in_browser ? Display::Columns(Config.song_columns_list_format) : "");
|
myBrowser->Main()->SetTitle(Config.columns_in_browser ? Display::Columns(Config.song_columns_list_format) : "");
|
||||||
}
|
}
|
||||||
else if (wCurrent == mySearcher->Main())
|
else if (myScreen == mySearcher)
|
||||||
{
|
{
|
||||||
Config.columns_in_search_engine = !Config.columns_in_search_engine;
|
Config.columns_in_search_engine = !Config.columns_in_search_engine;
|
||||||
ShowMessage("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic");
|
ShowMessage("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic");
|
||||||
@@ -1246,7 +1249,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
CHECK_MPD_MUSIC_DIR;
|
CHECK_MPD_MUSIC_DIR;
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
if (wCurrent == myLibrary->Artists)
|
if (myScreen->Cmp() == myLibrary->Artists)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << IntoStr(Config.media_lib_primary_tag) << fmtBoldEnd << ": ";
|
Statusbar() << fmtBold << IntoStr(Config.media_lib_primary_tag) << fmtBoldEnd << ": ";
|
||||||
@@ -1284,7 +1287,7 @@ int main(int argc, char *argv[])
|
|||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wCurrent == myLibrary->Albums)
|
else if (myScreen->Cmp() == myLibrary->Albums)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << "Album: " << fmtBoldEnd;
|
Statusbar() << fmtBold << "Album: " << fmtBoldEnd;
|
||||||
@@ -1322,16 +1325,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(wCurrent == myPlaylist->Main() && !myPlaylist->Main()->Empty())
|
(myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
|| (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == itSong)
|
|| (myScreen == myBrowser && myBrowser->Main()->Current().type == itSong)
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| (wCurrent == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
||||||
|| (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
|| (wCurrent == myTagEditor->Tags && !myTagEditor->Tags->Empty()))
|
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty()))
|
||||||
{
|
{
|
||||||
myTinyTagEditor->SwitchTo();
|
myTinyTagEditor->SwitchTo();
|
||||||
}
|
}
|
||||||
else if (wCurrent == myTagEditor->Dirs)
|
else if (myScreen->Cmp() == myTagEditor->Dirs)
|
||||||
{
|
{
|
||||||
string old_dir = myTagEditor->Dirs->Current().first;
|
string old_dir = myTagEditor->Dirs->Current().first;
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
@@ -1354,7 +1357,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
if (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == itDirectory)
|
if (myScreen == myBrowser && myBrowser->Main()->Current().type == itDirectory)
|
||||||
{
|
{
|
||||||
string old_dir = myBrowser->Main()->Current().name;
|
string old_dir = myBrowser->Main()->Current().name;
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
@@ -1383,9 +1386,9 @@ int main(int argc, char *argv[])
|
|||||||
ShowMessage("Cannot rename '%s' to '%s'!", old_dir.c_str(), new_dir.c_str());
|
ShowMessage("Cannot rename '%s' to '%s'!", old_dir.c_str(), new_dir.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wCurrent == myPlaylistEditor->List || (wCurrent == myBrowser->Main() && myBrowser->Main()->Current().type == itPlaylist))
|
else if (myScreen->Cmp() == myPlaylistEditor->List || (myScreen == myBrowser && myBrowser->Main()->Current().type == itPlaylist))
|
||||||
{
|
{
|
||||||
string old_name = wCurrent == myPlaylistEditor->List ? myPlaylistEditor->List->Current() : myBrowser->Main()->Current().name;
|
string old_name = myScreen->Cmp() == myPlaylistEditor->List ? myPlaylistEditor->List->Current() : myBrowser->Main()->Current().name;
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << "Playlist: " << fmtBoldEnd;
|
Statusbar() << fmtBold << "Playlist: " << fmtBoldEnd;
|
||||||
string new_name = wFooter->GetString(old_name);
|
string new_name = wFooter->GetString(old_name);
|
||||||
@@ -1402,16 +1405,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.GoToContainingDir))
|
else if (Keypressed(input, Key.GoToContainingDir))
|
||||||
{
|
{
|
||||||
if ((wCurrent == myPlaylist->Main() && !myPlaylist->Main()->Empty())
|
if ((myScreen == myPlaylist && !myPlaylist->Main()->Empty())
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| (wCurrent == myLibrary->Songs && !myLibrary->Songs->Empty())
|
|| (myScreen->Cmp() == myLibrary->Songs && !myLibrary->Songs->Empty())
|
||||||
|| (wCurrent == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
|| (myScreen->Cmp() == myPlaylistEditor->Content && !myPlaylistEditor->Content->Empty())
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| (wCurrent == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
|| (myScreen->Cmp() == myTagEditor->Tags && !myTagEditor->Tags->Empty())
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size_t id = ((Menu<Song> *)wCurrent)->Choice();
|
size_t id = ((Menu<Song> *)myScreen)->Choice();
|
||||||
Song *s = 0;
|
Song *s = 0;
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
@@ -1457,7 +1460,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.StartSearching))
|
else if (Keypressed(input, Key.StartSearching))
|
||||||
{
|
{
|
||||||
if (wCurrent == mySearcher->Main())
|
if (myScreen == mySearcher)
|
||||||
{
|
{
|
||||||
mySearcher->Main()->Highlight(SearchEngine::SearchButton);
|
mySearcher->Main()->Highlight(SearchEngine::SearchButton);
|
||||||
mySearcher->Main()->Highlighting(0);
|
mySearcher->Main()->Highlighting(0);
|
||||||
@@ -1485,24 +1488,24 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.ReverseSelection))
|
else if (Keypressed(input, Key.ReverseSelection))
|
||||||
{
|
{
|
||||||
if (wCurrent == myPlaylist->Main()
|
if (myScreen == myPlaylist
|
||||||
|| wCurrent == myBrowser->Main()
|
|| myScreen == myBrowser
|
||||||
|| (wCurrent == mySearcher->Main() && !mySearcher->Main()->Current().first)
|
|| (myScreen == mySearcher && !mySearcher->Main()->Current().first)
|
||||||
|| wCurrent == myLibrary->Songs
|
|| myScreen->Cmp() == myLibrary->Songs
|
||||||
|| wCurrent == myPlaylistEditor->Content
|
|| myScreen->Cmp() == myPlaylistEditor->Content
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->Tags
|
|| myScreen->Cmp() == myTagEditor->Tags
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(myWindow->Main());
|
||||||
for (size_t i = 0; i < mList->Size(); i++)
|
for (size_t i = 0; i < mList->Size(); i++)
|
||||||
mList->Select(i, !mList->isSelected(i) && !mList->isStatic(i));
|
mList->Select(i, !mList->isSelected(i) && !mList->isStatic(i));
|
||||||
// hackish shit begins
|
// hackish shit begins
|
||||||
if (wCurrent == myBrowser->Main() && myBrowser->CurrentDir() != "/")
|
if (myScreen == myBrowser && myBrowser->CurrentDir() != "/")
|
||||||
mList->Select(0, 0); // [..] cannot be selected, uhm.
|
mList->Select(0, 0); // [..] cannot be selected, uhm.
|
||||||
if (wCurrent == mySearcher->Main())
|
if (myScreen == mySearcher)
|
||||||
mList->Select(SearchEngine::ResetButton, 0); // 'Reset' cannot be selected, omgplz.
|
mList->Select(SearchEngine::ResetButton, 0); // 'Reset' cannot be selected, omgplz.
|
||||||
// hacking shit ends.
|
// hacking shit ends.
|
||||||
ShowMessage("Selection reversed!");
|
ShowMessage("Selection reversed!");
|
||||||
@@ -1510,17 +1513,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.DeselectAll))
|
else if (Keypressed(input, Key.DeselectAll))
|
||||||
{
|
{
|
||||||
if (wCurrent == myPlaylist->Main()
|
if (myScreen == myPlaylist
|
||||||
|| wCurrent == myBrowser->Main()
|
|| myScreen == myBrowser
|
||||||
|| wCurrent == mySearcher->Main()
|
|| myScreen == mySearcher
|
||||||
|| wCurrent == myLibrary->Songs
|
|| myScreen->Cmp() == myLibrary->Songs
|
||||||
|| wCurrent == myPlaylistEditor->Content
|
|| myScreen->Cmp() == myPlaylistEditor->Content
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| wCurrent == myTagEditor->Tags
|
|| myScreen->Cmp() == myTagEditor->Tags
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(myWindow->Main());
|
||||||
if (mList->hasSelected())
|
if (mList->hasSelected())
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < mList->Size(); i++)
|
for (size_t i = 0; i < mList->Size(); i++)
|
||||||
@@ -1531,14 +1534,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.AddSelected))
|
else if (Keypressed(input, Key.AddSelected))
|
||||||
{
|
{
|
||||||
if (wCurrent != myPlaylist->Main()
|
if (myScreen != myPlaylist
|
||||||
&& wCurrent != myBrowser->Main()
|
&& myScreen != myBrowser
|
||||||
&& wCurrent != mySearcher->Main()
|
&& myScreen != mySearcher
|
||||||
&& wCurrent != myLibrary->Songs
|
&& myScreen->Cmp() != myLibrary->Songs
|
||||||
&& wCurrent != myPlaylistEditor->Content)
|
&& myScreen->Cmp() != myPlaylistEditor->Content)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(myWindow->Main());
|
||||||
if (!mList->hasSelected())
|
if (!mList->hasSelected())
|
||||||
{
|
{
|
||||||
ShowMessage("No selected items!");
|
ShowMessage("No selected items!");
|
||||||
@@ -1668,7 +1671,7 @@ int main(int argc, char *argv[])
|
|||||||
myPlaylistEditor->Refresh();
|
myPlaylistEditor->Refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wCurrent->Refresh();
|
myScreen->Refresh();
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
@@ -1765,7 +1768,7 @@ int main(int argc, char *argv[])
|
|||||||
|| current_screen == csSearcher
|
|| current_screen == csSearcher
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
|| current_screen == csTinyTagEditor
|
|| current_screen == csTinyTagEditor
|
||||||
|| wCurrent == myTagEditor->TagTypes
|
|| myScreen->Cmp() == myTagEditor->TagTypes
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
)
|
)
|
||||||
&& (current_screen != csSearcher
|
&& (current_screen != csSearcher
|
||||||
@@ -1786,8 +1789,8 @@ int main(int argc, char *argv[])
|
|||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
ShowMessage("Searching...");
|
ShowMessage("Searching...");
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(myWindow->Main());
|
||||||
for (size_t i = (wCurrent == mySearcher->Main() ? 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)
|
switch (current_screen)
|
||||||
@@ -1814,22 +1817,22 @@ int main(int argc, char *argv[])
|
|||||||
name = mySearcher->Main()->at(i).second->toString(Config.song_list_format);
|
name = mySearcher->Main()->at(i).second->toString(Config.song_list_format);
|
||||||
break;
|
break;
|
||||||
case csLibrary:
|
case csLibrary:
|
||||||
if (wCurrent == myLibrary->Artists)
|
if (myScreen->Cmp() == myLibrary->Artists)
|
||||||
name = myLibrary->Artists->at(i);
|
name = myLibrary->Artists->at(i);
|
||||||
else if (wCurrent == 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;
|
break;
|
||||||
case csPlaylistEditor:
|
case csPlaylistEditor:
|
||||||
if (wCurrent == 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;
|
break;
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
case csTagEditor:
|
case csTagEditor:
|
||||||
if (wCurrent == myTagEditor->LeftColumn)
|
if (myScreen->Cmp() == myTagEditor->LeftColumn)
|
||||||
name = myTagEditor->LeftColumn->at(i).first;
|
name = myTagEditor->LeftColumn->at(i).first;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1908,7 +1911,7 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mList->Highlight(vFoundPositions[found_pos < 0 ? 0 : found_pos]);
|
mList->Highlight(vFoundPositions[found_pos < 0 ? 0 : found_pos]);
|
||||||
if (wCurrent == myPlaylist->Main())
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
myPlaylist->Main()->Highlighting(1);
|
myPlaylist->Main()->Highlighting(1);
|
||||||
@@ -1919,7 +1922,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (!vFoundPositions.empty())
|
if (!vFoundPositions.empty())
|
||||||
{
|
{
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(myWindow->Main());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mList->Highlight(vFoundPositions.at(Keypressed(input, Key.NextFoundPosition) ? ++found_pos : --found_pos));
|
mList->Highlight(vFoundPositions.at(Keypressed(input, Key.NextFoundPosition) ? ++found_pos : --found_pos));
|
||||||
@@ -1962,11 +1965,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.SwitchTagTypeList))
|
else if (Keypressed(input, Key.SwitchTagTypeList))
|
||||||
{
|
{
|
||||||
if (wCurrent == myBrowser->Main())
|
if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
myBrowser->ChangeBrowseMode();
|
myBrowser->ChangeBrowseMode();
|
||||||
}
|
}
|
||||||
else if (wCurrent == myLibrary->Artists)
|
else if (myScreen->Cmp() == myLibrary->Artists)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << "Tag type ? [" << fmtBold << 'a' << fmtBoldEnd << "rtist/" << fmtBold << 'y' << fmtBoldEnd << "ear/" << fmtBold << 'g' << fmtBoldEnd << "enre/" << fmtBold << 'c' << fmtBoldEnd << "omposer/" << fmtBold << 'p' << fmtBoldEnd << "erformer] ";
|
Statusbar() << "Tag type ? [" << fmtBold << 'a' << fmtBoldEnd << "rtist/" << fmtBold << 'y' << fmtBoldEnd << "ear/" << fmtBold << 'g' << fmtBoldEnd << "enre/" << fmtBold << 'c' << fmtBoldEnd << "omposer/" << fmtBold << 'p' << fmtBoldEnd << "erformer] ";
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ void Playlist::SwitchTo()
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = csPlaylist;
|
current_screen = csPlaylist;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
@@ -148,4 +148,4 @@ const MPD::Song &Playlist::NowPlayingSong()
|
|||||||
{
|
{
|
||||||
static MPD::Song null;
|
static MPD::Song null;
|
||||||
return isPlaying() ? w->at(NowPlaying) : null;
|
return isPlaying() ? w->at(NowPlaying) : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,13 +99,13 @@ void PlaylistEditor::SwitchTo()
|
|||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
myPlaylist->Main()->Hide(); // hack, should be wCurrent, 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_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
PlaylistEditor::Refresh();
|
Refresh();
|
||||||
|
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
current_screen = csPlaylistEditor;
|
current_screen = csPlaylistEditor;
|
||||||
|
|
||||||
UpdateSongList(Content);
|
UpdateSongList(Content);
|
||||||
@@ -157,11 +157,11 @@ void PlaylistEditor::Update()
|
|||||||
Content->Display();
|
Content->Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wCurrent == Content && Content->Empty())
|
if (w == Content && Content->Empty())
|
||||||
{
|
{
|
||||||
Content->HighlightColor(Config.main_highlight_color);
|
Content->HighlightColor(Config.main_highlight_color);
|
||||||
List->HighlightColor(Config.active_column_color);
|
List->HighlightColor(Config.active_column_color);
|
||||||
wCurrent = w = List;
|
w = List;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Content->Empty())
|
if (Content->Empty())
|
||||||
@@ -178,7 +178,7 @@ void PlaylistEditor::NextColumn()
|
|||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
List->HighlightColor(Config.main_highlight_color);
|
List->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = Content;
|
w = Content;
|
||||||
Content->HighlightColor(Config.active_column_color);
|
Content->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ void PlaylistEditor::PrevColumn()
|
|||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
Content->HighlightColor(Config.main_highlight_color);
|
Content->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = List;
|
w = List;
|
||||||
List->HighlightColor(Config.active_column_color);
|
List->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
{
|
{
|
||||||
SongList list;
|
SongList list;
|
||||||
|
|
||||||
if (wCurrent == List && !List->Empty())
|
if (w == List && !List->Empty())
|
||||||
{
|
{
|
||||||
Mpd->GetPlaylistContent(locale_to_utf_cpy(List->Current()), list);
|
Mpd->GetPlaylistContent(locale_to_utf_cpy(List->Current()), list);
|
||||||
for (SongList::const_iterator it = list.begin(); it != list.end(); it++)
|
for (SongList::const_iterator it = list.begin(); it != list.end(); it++)
|
||||||
@@ -217,7 +217,7 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
ShowMessage("%s", message_part_of_songs_added);
|
ShowMessage("%s", message_part_of_songs_added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wCurrent == Content)
|
else if (w == Content)
|
||||||
{
|
{
|
||||||
if (!Content->Empty())
|
if (!Content->Empty())
|
||||||
{
|
{
|
||||||
@@ -254,7 +254,7 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Song &s = Content->at(Content->Choice());
|
const Song &s = Content->Current();
|
||||||
int id = Mpd->AddSong(s);
|
int id = Mpd->AddSong(s);
|
||||||
if (id >= 0)
|
if (id >= 0)
|
||||||
{
|
{
|
||||||
@@ -268,6 +268,6 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
}
|
}
|
||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
if (!add_n_play)
|
if (!add_n_play)
|
||||||
wCurrent->Scroll(wDown);
|
w->Scroll(wDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/screen.h
14
src/screen.h
@@ -29,6 +29,8 @@ class BasicScreen
|
|||||||
BasicScreen() { }
|
BasicScreen() { }
|
||||||
virtual ~BasicScreen() { }
|
virtual ~BasicScreen() { }
|
||||||
|
|
||||||
|
virtual void *&Cmp() = 0;
|
||||||
|
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void SwitchTo() = 0;
|
virtual void SwitchTo() = 0;
|
||||||
virtual void Resize() = 0;
|
virtual void Resize() = 0;
|
||||||
@@ -48,7 +50,9 @@ template <class WindowType> class Screen : public BasicScreen
|
|||||||
Screen() : w(0) { }
|
Screen() : w(0) { }
|
||||||
virtual ~Screen() { }
|
virtual ~Screen() { }
|
||||||
|
|
||||||
WindowType *Main();
|
virtual void *&Cmp();
|
||||||
|
|
||||||
|
WindowType *&Main();
|
||||||
|
|
||||||
virtual void Refresh();
|
virtual void Refresh();
|
||||||
|
|
||||||
@@ -56,7 +60,13 @@ template <class WindowType> class Screen : public BasicScreen
|
|||||||
WindowType *w;
|
WindowType *w;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class WindowType> WindowType *Screen<WindowType>::Main()
|
template <class WindowType> void *&Screen<WindowType>::Cmp()
|
||||||
|
{
|
||||||
|
return *(void **)(void *)&w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class WindowType> WindowType *&Screen<WindowType>::Main()
|
||||||
{
|
{
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ void SearchEngine::SwitchTo()
|
|||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
if (w->Empty())
|
if (w->Empty())
|
||||||
Prepare();
|
Prepare();
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
wCurrent->Hide();
|
w->Hide();
|
||||||
current_screen = csSearcher;
|
current_screen = csSearcher;
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (!w->Back().first)
|
if (!w->Back().first)
|
||||||
{
|
{
|
||||||
wCurrent->WriteXY(0, 0, 0, "Updating list...");
|
w->WriteXY(0, 0, 0, "Updating list...");
|
||||||
UpdateFoundList();
|
UpdateFoundList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void TinyTagEditor::Resize()
|
|||||||
|
|
||||||
void TinyTagEditor::SwitchTo()
|
void TinyTagEditor::SwitchTo()
|
||||||
{
|
{
|
||||||
List *mList = reinterpret_cast<Menu<Song> *>(wCurrent);
|
List *mList = reinterpret_cast<Menu<Song> *>(((Screen<Window> *)myScreen)->Main());
|
||||||
size_t id = mList->Choice();
|
size_t id = mList->Choice();
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
@@ -91,8 +91,8 @@ void TinyTagEditor::SwitchTo()
|
|||||||
}
|
}
|
||||||
else if (GetTags())
|
else if (GetTags())
|
||||||
{
|
{
|
||||||
wPrev = wCurrent;
|
myOldScreen = myScreen;
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
prev_screen = current_screen;
|
prev_screen = current_screen;
|
||||||
current_screen = csTinyTagEditor;
|
current_screen = csTinyTagEditor;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
@@ -221,9 +221,9 @@ void TinyTagEditor::EnterPressed()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wPrev == myPlaylist->Main())
|
if (myOldScreen == myPlaylist)
|
||||||
myPlaylist->Main()->Current() = s;
|
myPlaylist->Main()->Current() = s;
|
||||||
else if (wPrev == myBrowser->Main())
|
else if (myOldScreen == myBrowser)
|
||||||
*myBrowser->Main()->Current().song = s;
|
*myBrowser->Main()->Current().song = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,8 +232,8 @@ void TinyTagEditor::EnterPressed()
|
|||||||
}
|
}
|
||||||
case 15:
|
case 15:
|
||||||
{
|
{
|
||||||
wCurrent->Clear();
|
w->Clear();
|
||||||
wCurrent = wPrev;
|
myScreen = myOldScreen;
|
||||||
current_screen = prev_screen;
|
current_screen = prev_screen;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary)
|
||||||
@@ -392,7 +392,7 @@ void TagEditor::SwitchTo()
|
|||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
|
|
||||||
myPlaylist->Main()->Hide(); // hack, should be wCurrent, 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_screen = 1;
|
||||||
redraw_header = 1;
|
redraw_header = 1;
|
||||||
@@ -422,7 +422,7 @@ void TagEditor::SwitchTo()
|
|||||||
TagTypes->AddOption("lower all letters");
|
TagTypes->AddOption("lower all letters");
|
||||||
}
|
}
|
||||||
|
|
||||||
wCurrent = w;
|
myScreen = this;
|
||||||
current_screen = csTagEditor;
|
current_screen = csTagEditor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -527,7 +527,7 @@ void TagEditor::Update()
|
|||||||
Tags->Refresh();
|
Tags->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*redraw_screen && */wCurrent == TagTypes && TagTypes->Choice() < 13)
|
if (/*redraw_screen && */w == TagTypes && TagTypes->Choice() < 13)
|
||||||
{
|
{
|
||||||
Tags->Refresh();
|
Tags->Refresh();
|
||||||
// redraw_screen = 0;
|
// redraw_screen = 0;
|
||||||
@@ -538,7 +538,7 @@ void TagEditor::Update()
|
|||||||
|
|
||||||
void TagEditor::EnterPressed()
|
void TagEditor::EnterPressed()
|
||||||
{
|
{
|
||||||
if (wCurrent == Dirs)
|
if (w == Dirs)
|
||||||
{
|
{
|
||||||
TagList test;
|
TagList test;
|
||||||
Mpd->GetDirectories(LeftColumn->Current().second, test);
|
Mpd->GetDirectories(LeftColumn->Current().second, test);
|
||||||
@@ -595,7 +595,7 @@ void TagEditor::EnterPressed()
|
|||||||
case 4:
|
case 4:
|
||||||
get = &Song::GetTrack;
|
get = &Song::GetTrack;
|
||||||
set = &Song::SetTrack;
|
set = &Song::SetTrack;
|
||||||
if (wCurrent == TagTypes)
|
if (w == TagTypes)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << "Number tracks? [y/n] ";
|
Statusbar() << "Number tracks? [y/n] ";
|
||||||
@@ -642,14 +642,14 @@ void TagEditor::EnterPressed()
|
|||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
{
|
{
|
||||||
if (wCurrent == TagTypes)
|
if (w == TagTypes)
|
||||||
{
|
{
|
||||||
current_screen = csOther;
|
current_screen = csOther;
|
||||||
DealWithFilenames(list);
|
DealWithFilenames(list);
|
||||||
current_screen = csTagEditor;
|
current_screen = csTagEditor;
|
||||||
TagEditor::Refresh();
|
TagEditor::Refresh();
|
||||||
}
|
}
|
||||||
else if (wCurrent == Tags)
|
else if (w == Tags)
|
||||||
{
|
{
|
||||||
Song &s = Tags->Current();
|
Song &s = Tags->Current();
|
||||||
string old_name = s.GetNewName().empty() ? s.GetName() : s.GetNewName();
|
string old_name = s.GetNewName().empty() ? s.GetName() : s.GetNewName();
|
||||||
@@ -691,8 +691,8 @@ void TagEditor::EnterPressed()
|
|||||||
ShowMessage("Tags updated!");
|
ShowMessage("Tags updated!");
|
||||||
TagTypes->HighlightColor(Config.main_highlight_color);
|
TagTypes->HighlightColor(Config.main_highlight_color);
|
||||||
TagTypes->Reset();
|
TagTypes->Reset();
|
||||||
wCurrent->Refresh();
|
w->Refresh();
|
||||||
wCurrent = LeftColumn;
|
w = LeftColumn;
|
||||||
LeftColumn->HighlightColor(Config.active_column_color);
|
LeftColumn->HighlightColor(Config.active_column_color);
|
||||||
Mpd->UpdateDirectory(FindSharedDir(Tags));
|
Mpd->UpdateDirectory(FindSharedDir(Tags));
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,7 @@ void TagEditor::EnterPressed()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wCurrent == TagTypes && id != 0 && id != 4 && set != NULL)
|
if (w == TagTypes && id != 0 && id != 4 && set != NULL)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << TagTypes->Current() << fmtBoldEnd << ": ";
|
Statusbar() << fmtBold << TagTypes->Current() << fmtBoldEnd << ": ";
|
||||||
@@ -729,7 +729,7 @@ void TagEditor::EnterPressed()
|
|||||||
for (SongList::iterator it = list.begin(); it != list.end(); it++)
|
for (SongList::iterator it = list.begin(); it != list.end(); it++)
|
||||||
(**it.*set)(new_tag);
|
(**it.*set)(new_tag);
|
||||||
}
|
}
|
||||||
else if (wCurrent == Tags && set != NULL)
|
else if (w == Tags && set != NULL)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << TagTypes->Current() << fmtBoldEnd << ": ";
|
Statusbar() << fmtBold << TagTypes->Current() << fmtBoldEnd << ": ";
|
||||||
@@ -743,11 +743,11 @@ void TagEditor::EnterPressed()
|
|||||||
|
|
||||||
void TagEditor::SpacePressed()
|
void TagEditor::SpacePressed()
|
||||||
{
|
{
|
||||||
if (wCurrent != LeftColumn)
|
if (w != LeftColumn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Config.albums_in_tag_editor = !Config.albums_in_tag_editor;
|
Config.albums_in_tag_editor = !Config.albums_in_tag_editor;
|
||||||
wCurrent = w = LeftColumn = Config.albums_in_tag_editor ? Albums : Dirs;
|
w = LeftColumn = Config.albums_in_tag_editor ? Albums : Dirs;
|
||||||
ShowMessage("Switched to %s view", Config.albums_in_tag_editor ? "albums" : "directories");
|
ShowMessage("Switched to %s view", Config.albums_in_tag_editor ? "albums" : "directories");
|
||||||
LeftColumn->Display();
|
LeftColumn->Display();
|
||||||
Tags->Clear(0);
|
Tags->Clear(0);
|
||||||
@@ -756,18 +756,18 @@ void TagEditor::SpacePressed()
|
|||||||
void TagEditor::NextColumn()
|
void TagEditor::NextColumn()
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
if (wCurrent == LeftColumn)
|
if (w == LeftColumn)
|
||||||
{
|
{
|
||||||
LeftColumn->HighlightColor(Config.main_highlight_color);
|
LeftColumn->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = TagTypes;
|
w = TagTypes;
|
||||||
TagTypes->HighlightColor(Config.active_column_color);
|
TagTypes->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
else if (wCurrent == TagTypes && TagTypes->Choice() < 12 && !Tags->Empty())
|
else if (w == TagTypes && TagTypes->Choice() < 12 && !Tags->Empty())
|
||||||
{
|
{
|
||||||
TagTypes->HighlightColor(Config.main_highlight_color);
|
TagTypes->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = myTagEditor->Tags;
|
w = myTagEditor->Tags;
|
||||||
Tags->HighlightColor(Config.active_column_color);
|
Tags->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -775,18 +775,18 @@ void TagEditor::NextColumn()
|
|||||||
void TagEditor::PrevColumn()
|
void TagEditor::PrevColumn()
|
||||||
{
|
{
|
||||||
CLEAR_FIND_HISTORY;
|
CLEAR_FIND_HISTORY;
|
||||||
if (wCurrent == Tags)
|
if (w == Tags)
|
||||||
{
|
{
|
||||||
Tags->HighlightColor(Config.main_highlight_color);
|
Tags->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = TagTypes;
|
w = TagTypes;
|
||||||
TagTypes->HighlightColor(Config.active_column_color);
|
TagTypes->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
else if (wCurrent == TagTypes)
|
else if (w == TagTypes)
|
||||||
{
|
{
|
||||||
TagTypes->HighlightColor(Config.main_highlight_color);
|
TagTypes->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
wCurrent = w = LeftColumn;
|
w = LeftColumn;
|
||||||
LeftColumn->HighlightColor(Config.active_column_color);
|
LeftColumn->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -884,7 +884,7 @@ bool TagEditor::WriteTags(Song &s)
|
|||||||
locale_to_utf(new_name);
|
locale_to_utf(new_name);
|
||||||
if (rename(path_to_file.c_str(), new_name.c_str()) == 0 && !file_is_from_db)
|
if (rename(path_to_file.c_str(), new_name.c_str()) == 0 && !file_is_from_db)
|
||||||
{
|
{
|
||||||
if (wPrev == myPlaylist->Main())
|
if (myOldScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
// if we rename local file, it won't get updated
|
// if we rename local file, it won't get updated
|
||||||
// so just remove it from playlist and add again
|
// so just remove it from playlist and add again
|
||||||
|
|||||||
Reference in New Issue
Block a user