|
|
|
|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
|
|
|
|
#define UNLOCK_STATUSBAR \
|
|
|
|
|
allow_statusbar_unblock = 1; \
|
|
|
|
|
if (block_statusbar_update_delay <= 0) \
|
|
|
|
|
if (block_statusbar_update_delay < 0) \
|
|
|
|
|
{ \
|
|
|
|
|
if (Config.statusbar_visibility) \
|
|
|
|
|
block_statusbar_update = 0; \
|
|
|
|
|
@@ -59,6 +59,7 @@
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ncmpcpp_config Config;
|
|
|
|
|
ncmpcpp_keys Key;
|
|
|
|
|
|
|
|
|
|
SongList vPlaylist;
|
|
|
|
|
SongList vSearched;
|
|
|
|
|
@@ -146,6 +147,7 @@ const string message_part_of_songs_added = "Only part of requested songs' list a
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
DefaultConfiguration(Config);
|
|
|
|
|
DefaultKeys(Key);
|
|
|
|
|
ReadConfiguration(Config);
|
|
|
|
|
DefineEmptyTags();
|
|
|
|
|
|
|
|
|
|
@@ -248,7 +250,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
sHelp->Add(" [b]Keys - Playlist screen\n -----------------------------------------[/b]\n");
|
|
|
|
|
sHelp->Add("\tEnter : Play\n");
|
|
|
|
|
sHelp->Add("\tDelete : Delete song from playlist\n");
|
|
|
|
|
sHelp->Add("\tDelete d : Delete song from playlist\n");
|
|
|
|
|
sHelp->Add("\tc : Clear whole playlist\n");
|
|
|
|
|
sHelp->Add("\tC : Clear playlist but hold currently playing song\n");
|
|
|
|
|
sHelp->Add("\tm : Move song up\n");
|
|
|
|
|
@@ -261,7 +263,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
sHelp->Add("\tEnter : Enter directory/Add item to playlist and play\n");
|
|
|
|
|
sHelp->Add("\tSpace : Add item to playlist\n");
|
|
|
|
|
sHelp->Add("\tBackspace : Go to parent directory\n");
|
|
|
|
|
sHelp->Add("\tDelete : Delete playlist\n\n\n");
|
|
|
|
|
sHelp->Add("\tDelete d : Delete playlist\n\n\n");
|
|
|
|
|
|
|
|
|
|
sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n");
|
|
|
|
|
sHelp->Add("\tEnter : Change option/Add to playlist and play song\n");
|
|
|
|
|
@@ -496,7 +498,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
break;
|
|
|
|
|
case csLibrary:
|
|
|
|
|
{
|
|
|
|
|
if (input == KEY_UP || input == 'k' || input == KEY_DOWN || input == 'j' || input == KEY_PPAGE || input == KEY_NPAGE || input == KEY_HOME || input == KEY_END)
|
|
|
|
|
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))
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == mLibArtists)
|
|
|
|
|
{
|
|
|
|
|
@@ -512,15 +514,21 @@ int main(int argc, char *argv[])
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (input)
|
|
|
|
|
{
|
|
|
|
|
case KEY_UP: case 'k': wCurrent->Go(UP); continue;
|
|
|
|
|
case KEY_DOWN: case 'j': wCurrent->Go(DOWN); continue;
|
|
|
|
|
case KEY_PPAGE: wCurrent->Go(PAGE_UP); continue;
|
|
|
|
|
case KEY_NPAGE: wCurrent->Go(PAGE_DOWN); continue;
|
|
|
|
|
case KEY_HOME: wCurrent->Go(HOME); continue;
|
|
|
|
|
case KEY_END: wCurrent->Go(END); continue;
|
|
|
|
|
case KEY_RESIZE:
|
|
|
|
|
// key mapping beginning
|
|
|
|
|
|
|
|
|
|
if (Keypressed(input, Key.Up))
|
|
|
|
|
wCurrent->Go(UP);
|
|
|
|
|
else if (Keypressed(input, Key.Down))
|
|
|
|
|
wCurrent->Go(DOWN);
|
|
|
|
|
else if (Keypressed(input, Key.PageUp))
|
|
|
|
|
wCurrent->Go(PAGE_UP);
|
|
|
|
|
else if (Keypressed(input, Key.PageDown))
|
|
|
|
|
wCurrent->Go(PAGE_DOWN);
|
|
|
|
|
else if (Keypressed(input, Key.Home))
|
|
|
|
|
wCurrent->Go(HOME);
|
|
|
|
|
else if (Keypressed(input, Key.End))
|
|
|
|
|
wCurrent->Go(END);
|
|
|
|
|
else if (input == KEY_RESIZE)
|
|
|
|
|
{
|
|
|
|
|
int in;
|
|
|
|
|
|
|
|
|
|
@@ -598,17 +606,16 @@ int main(int argc, char *argv[])
|
|
|
|
|
changes.PlayerState = 1;
|
|
|
|
|
|
|
|
|
|
NcmpcppStatusChanged(Mpd, changes, NULL);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case KEY_BACKSPACE: case 127:
|
|
|
|
|
else if (Keypressed(input, Key.GoToParentDir))
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == mBrowser && browsed_dir != "/")
|
|
|
|
|
{
|
|
|
|
|
mBrowser->Reset();
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
goto GO_TO_PARENT_DIR;
|
|
|
|
|
}
|
|
|
|
|
case ENTER:
|
|
|
|
|
}
|
|
|
|
|
else if (Keypressed(input, Key.Enter))
|
|
|
|
|
{
|
|
|
|
|
switch (current_screen)
|
|
|
|
|
{
|
|
|
|
|
@@ -620,6 +627,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
case csBrowser:
|
|
|
|
|
{
|
|
|
|
|
GO_TO_PARENT_DIR:
|
|
|
|
|
|
|
|
|
|
int ci = mBrowser->GetChoice()-1;
|
|
|
|
|
switch (vBrowser[ci].type)
|
|
|
|
|
{
|
|
|
|
|
@@ -775,8 +784,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
f.tag()->setTitle(NCMPCPP_TO_WSTRING(s.GetTitle()));
|
|
|
|
|
f.tag()->setArtist(NCMPCPP_TO_WSTRING(s.GetArtist()));
|
|
|
|
|
f.tag()->setAlbum(NCMPCPP_TO_WSTRING(s.GetAlbum()));
|
|
|
|
|
f.tag()->setYear(atoi(s.GetYear().c_str()));
|
|
|
|
|
f.tag()->setTrack(atoi(s.GetTrack().c_str()));
|
|
|
|
|
f.tag()->setYear(StrToInt(s.GetYear()));
|
|
|
|
|
f.tag()->setTrack(StrToInt(s.GetTrack()));
|
|
|
|
|
f.tag()->setGenre(NCMPCPP_TO_WSTRING(s.GetGenre()));
|
|
|
|
|
f.tag()->setComment(NCMPCPP_TO_WSTRING(s.GetComment()));
|
|
|
|
|
s.GetEmptyFields(0);
|
|
|
|
|
@@ -985,7 +994,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
case csLibrary:
|
|
|
|
|
{
|
|
|
|
|
Start_Point_For_KEY_SPACE: // same code for KEY_SPACE, but without playing.
|
|
|
|
|
ENTER_LIBRARY_SCREEN: // same code for Key.Space, but without playing.
|
|
|
|
|
|
|
|
|
|
SongList list;
|
|
|
|
|
|
|
|
|
|
@@ -1003,33 +1012,31 @@ int main(int argc, char *argv[])
|
|
|
|
|
Song *s = vPlaylist[vPlaylist.size()-list.size()];
|
|
|
|
|
if (s->GetHash() == list[0]->GetHash())
|
|
|
|
|
{
|
|
|
|
|
if (input == ENTER)
|
|
|
|
|
if (Keypressed(input, Key.Enter))
|
|
|
|
|
Mpd->PlayID(s->GetID());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ShowMessage(message_part_of_songs_added);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wCurrent == mLibAlbums)
|
|
|
|
|
else if (wCurrent == mLibAlbums)
|
|
|
|
|
{
|
|
|
|
|
for (SongList::const_iterator it = vSongs.begin(); it != vSongs.end(); it++)
|
|
|
|
|
Mpd->QueueAddSong(**it);
|
|
|
|
|
if (Mpd->CommitQueue())
|
|
|
|
|
{
|
|
|
|
|
ShowMessage("Adding songs from album: " + mLibAlbums->GetCurrentOption());
|
|
|
|
|
ShowMessage("Adding songs from: " + mLibArtists->GetCurrentOption() + " \"" + mLibAlbums->GetCurrentOption() + "\"");
|
|
|
|
|
Song *s = vPlaylist[vPlaylist.size()-vSongs.size()];
|
|
|
|
|
if (s->GetHash() == vSongs[0]->GetHash())
|
|
|
|
|
{
|
|
|
|
|
if (input == ENTER)
|
|
|
|
|
if (Keypressed(input, Key.Enter))
|
|
|
|
|
Mpd->PlayID(s->GetID());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ShowMessage(message_part_of_songs_added);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wCurrent == mLibSongs)
|
|
|
|
|
else if (wCurrent == mLibSongs)
|
|
|
|
|
{
|
|
|
|
|
if (!vSongs.empty())
|
|
|
|
|
{
|
|
|
|
|
@@ -1038,7 +1045,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
if (id >= 0)
|
|
|
|
|
{
|
|
|
|
|
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
|
|
|
|
if (input == ENTER)
|
|
|
|
|
if (Keypressed(input, Key.Enter))
|
|
|
|
|
Mpd->PlayID(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1046,7 +1053,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
FreeSongList(list);
|
|
|
|
|
|
|
|
|
|
if (input == KEY_SPACE)
|
|
|
|
|
if (Keypressed(input, Key.Space))
|
|
|
|
|
wCurrent->Go(DOWN);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
@@ -1054,9 +1061,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case KEY_SPACE:
|
|
|
|
|
else if (Keypressed(input, Key.Space))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen == csBrowser)
|
|
|
|
|
{
|
|
|
|
|
@@ -1108,24 +1114,23 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
mBrowser->Go(DOWN);
|
|
|
|
|
}
|
|
|
|
|
if (current_screen == csSearcher && !vSearched.empty())
|
|
|
|
|
else if (current_screen == csSearcher && !vSearched.empty())
|
|
|
|
|
{
|
|
|
|
|
int id = mSearcher->GetChoice()-search_engine_static_option-1;
|
|
|
|
|
if (id < 0)
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Song &s = *vSearched[id];
|
|
|
|
|
if (Mpd->AddSong(s) != -1)
|
|
|
|
|
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
|
|
|
|
mSearcher->Go(DOWN);
|
|
|
|
|
}
|
|
|
|
|
if (current_screen == csLibrary)
|
|
|
|
|
goto Start_Point_For_KEY_SPACE; // sorry, but that's stupid to copy the same code here.
|
|
|
|
|
break;
|
|
|
|
|
else if (current_screen == csLibrary)
|
|
|
|
|
goto ENTER_LIBRARY_SCREEN; // sorry, but that's stupid to copy the same code here.
|
|
|
|
|
}
|
|
|
|
|
case KEY_RIGHT:
|
|
|
|
|
else if (Keypressed(input, Key.VolumeUp))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen == csLibrary)
|
|
|
|
|
if (current_screen == csLibrary && input == Key.VolumeUp[0])
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == mLibArtists)
|
|
|
|
|
{
|
|
|
|
|
@@ -1134,7 +1139,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
wCurrent = mLibAlbums;
|
|
|
|
|
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
|
|
|
|
if (!mLibAlbums->Empty())
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (wCurrent == mLibAlbums)
|
|
|
|
|
{
|
|
|
|
|
@@ -1142,19 +1147,14 @@ int main(int argc, char *argv[])
|
|
|
|
|
wCurrent->Refresh();
|
|
|
|
|
wCurrent = mLibSongs;
|
|
|
|
|
mLibSongs->HighlightColor(Config.library_active_column_color);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case '+': // volume up
|
|
|
|
|
{
|
|
|
|
|
else
|
|
|
|
|
Mpd->SetVolume(Mpd->GetVolume()+1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case KEY_LEFT:
|
|
|
|
|
else if (Keypressed(input, Key.VolumeDown))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen == csLibrary)
|
|
|
|
|
if (current_screen == csLibrary && input == Key.VolumeDown[0])
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == mLibSongs)
|
|
|
|
|
{
|
|
|
|
|
@@ -1163,7 +1163,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
wCurrent = mLibAlbums;
|
|
|
|
|
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
|
|
|
|
if (!mLibAlbums->Empty())
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (wCurrent == mLibAlbums)
|
|
|
|
|
{
|
|
|
|
|
@@ -1171,17 +1171,12 @@ int main(int argc, char *argv[])
|
|
|
|
|
wCurrent->Refresh();
|
|
|
|
|
wCurrent = mLibArtists;
|
|
|
|
|
mLibArtists->HighlightColor(Config.library_active_column_color);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case '-': // volume down
|
|
|
|
|
{
|
|
|
|
|
else
|
|
|
|
|
Mpd->SetVolume(Mpd->GetVolume()-1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case KEY_DC: // delete position from list
|
|
|
|
|
else if (Keypressed(input, Key.Delete))
|
|
|
|
|
{
|
|
|
|
|
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
|
|
|
|
{
|
|
|
|
|
@@ -1190,23 +1185,17 @@ int main(int argc, char *argv[])
|
|
|
|
|
mPlaylist->Timeout(50);
|
|
|
|
|
int id = mPlaylist->GetChoice()-1;
|
|
|
|
|
|
|
|
|
|
while (!vPlaylist.empty() && input == KEY_DC)
|
|
|
|
|
while (!vPlaylist.empty() && Keypressed(input, Key.Delete))
|
|
|
|
|
{
|
|
|
|
|
TraceMpdStatus();
|
|
|
|
|
timer = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (input == KEY_DC)
|
|
|
|
|
{
|
|
|
|
|
id = mPlaylist->GetChoice()-1;
|
|
|
|
|
|
|
|
|
|
Mpd->QueueDeleteSong(id);
|
|
|
|
|
delete vPlaylist[id];
|
|
|
|
|
vPlaylist.erase(vPlaylist.begin()+id);
|
|
|
|
|
mPlaylist->DeleteOption(id+1);
|
|
|
|
|
if (now_playing > id)
|
|
|
|
|
now_playing--;
|
|
|
|
|
mPlaylist->Refresh();
|
|
|
|
|
}
|
|
|
|
|
mPlaylist->ReadKey(input);
|
|
|
|
|
}
|
|
|
|
|
Mpd->CommitQueue();
|
|
|
|
|
@@ -1219,7 +1208,6 @@ int main(int argc, char *argv[])
|
|
|
|
|
int id = mBrowser->GetChoice()-1;
|
|
|
|
|
if (vBrowser[id].type == itPlaylist)
|
|
|
|
|
{
|
|
|
|
|
block_statusbar_update = 1;
|
|
|
|
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Delete playlist " + vBrowser[id].name + " ? [y/n] ", 1);
|
|
|
|
|
curs_set(1);
|
|
|
|
|
int in = 0;
|
|
|
|
|
@@ -1229,7 +1217,6 @@ int main(int argc, char *argv[])
|
|
|
|
|
wFooter->ReadKey(in);
|
|
|
|
|
}
|
|
|
|
|
while (in != 'y' && in != 'n');
|
|
|
|
|
block_statusbar_update = 0;
|
|
|
|
|
if (in == 'y')
|
|
|
|
|
{
|
|
|
|
|
Mpd->DeletePlaylist(vBrowser[id].name);
|
|
|
|
|
@@ -1239,27 +1226,17 @@ int main(int argc, char *argv[])
|
|
|
|
|
else
|
|
|
|
|
ShowMessage("Aborted!");
|
|
|
|
|
curs_set(0);
|
|
|
|
|
}
|
|
|
|
|
UNLOCK_STATUSBAR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '<': // previous
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.Prev))
|
|
|
|
|
Mpd->Prev();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '>': // next
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.Next))
|
|
|
|
|
Mpd->Next();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'P': // pause
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.Pause))
|
|
|
|
|
Mpd->Pause();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'S': // save playlist
|
|
|
|
|
else if (Keypressed(input, Key.SavePlaylist))
|
|
|
|
|
{
|
|
|
|
|
LOCK_STATUSBAR;
|
|
|
|
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Save playlist as: ", 1);
|
|
|
|
|
@@ -1279,14 +1256,10 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
if (browsed_dir == "/" && !vBrowser.empty())
|
|
|
|
|
GetDirectory(browsed_dir);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 's': // stop
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.Stop))
|
|
|
|
|
Mpd->Stop();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'm': // move song up
|
|
|
|
|
else if (Keypressed(input, Key.MvSongUp))
|
|
|
|
|
{
|
|
|
|
|
block_playlist_update = 1;
|
|
|
|
|
int pos = mPlaylist->GetChoice()-1;
|
|
|
|
|
@@ -1313,9 +1286,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
Mpd->Move(pos, pos-1);
|
|
|
|
|
mPlaylist->Go(UP);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'n': // move song down
|
|
|
|
|
else if (Keypressed(input, Key.MvSongDown))
|
|
|
|
|
{
|
|
|
|
|
block_playlist_update = 1;
|
|
|
|
|
int pos = mPlaylist->GetChoice()-1;
|
|
|
|
|
@@ -1342,12 +1314,11 @@ int main(int argc, char *argv[])
|
|
|
|
|
Mpd->Move(pos, pos+1);
|
|
|
|
|
mPlaylist->Go(DOWN);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'f': case 'b': // seek through song
|
|
|
|
|
else if (Keypressed(input, Key.SeekForward) || Keypressed(input, Key.SeekBackward))
|
|
|
|
|
{
|
|
|
|
|
if (now_playing < 0)
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
block_progressbar_update = 1;
|
|
|
|
|
LOCK_STATUSBAR;
|
|
|
|
|
@@ -1362,11 +1333,11 @@ int main(int argc, char *argv[])
|
|
|
|
|
TraceMpdStatus();
|
|
|
|
|
timer = time(NULL);
|
|
|
|
|
mPlaylist->ReadKey(in);
|
|
|
|
|
if (in == 'f' || in == 'b')
|
|
|
|
|
if (Keypressed(in, Key.SeekForward) || Keypressed(in, Key.SeekBackward))
|
|
|
|
|
{
|
|
|
|
|
if (songpos < s.GetTotalLength() && in == 'f')
|
|
|
|
|
if (songpos < s.GetTotalLength() && Keypressed(in, Key.SeekForward))
|
|
|
|
|
songpos++;
|
|
|
|
|
if (songpos < s.GetTotalLength() && songpos > 0 && in == 'b')
|
|
|
|
|
if (songpos < s.GetTotalLength() && songpos > 0 && Keypressed(in, Key.SeekBackward))
|
|
|
|
|
songpos--;
|
|
|
|
|
if (songpos < 0)
|
|
|
|
|
songpos = 0;
|
|
|
|
|
@@ -1390,50 +1361,33 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
block_progressbar_update = 0;
|
|
|
|
|
UNLOCK_STATUSBAR;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'U': // toggle autocenter mode
|
|
|
|
|
else if (Keypressed(input, Key.ToggleAutoCenter))
|
|
|
|
|
{
|
|
|
|
|
Config.autocenter_mode = !Config.autocenter_mode;
|
|
|
|
|
ShowMessage("Auto center mode: " + string(Config.autocenter_mode ? "On" : "Off"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'u': // update database
|
|
|
|
|
else if (Keypressed(input, Key.UpdateDB))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen == csBrowser)
|
|
|
|
|
Mpd->UpdateDirectory(browsed_dir);
|
|
|
|
|
else
|
|
|
|
|
Mpd->UpdateDirectory("/");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'o': // go to playing song
|
|
|
|
|
else if (Keypressed(input, Key.GoToNowPlaying))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen == csPlaylist && now_playing >= 0)
|
|
|
|
|
mPlaylist->Highlight(now_playing+1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'r': // switch repeat state
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.ToggleRepeat))
|
|
|
|
|
Mpd->SetRepeat(!Mpd->GetRepeat());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'Z': // shuffle playlist
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.Shuffle))
|
|
|
|
|
Mpd->Shuffle();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'z': // switch random state
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.ToggleRandom))
|
|
|
|
|
Mpd->SetRandom(!Mpd->GetRandom());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'x': // switch crossfade state
|
|
|
|
|
{
|
|
|
|
|
else if (Keypressed(input, Key.ToggleCrossfade))
|
|
|
|
|
Mpd->SetCrossfade(Mpd->GetCrossfade() ? 0 : Config.crossfade_time);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'X': // set crossfade
|
|
|
|
|
else if (Keypressed(input, Key.SetCrossfade))
|
|
|
|
|
{
|
|
|
|
|
LOCK_STATUSBAR;
|
|
|
|
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Set crossfade to: ", 1);
|
|
|
|
|
@@ -1445,9 +1399,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
Config.crossfade_time = cf;
|
|
|
|
|
Mpd->SetCrossfade(cf);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'e': // edit song's tags
|
|
|
|
|
else if (Keypressed(input, Key.EditTags))
|
|
|
|
|
{
|
|
|
|
|
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
|
|
|
|
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
|
|
|
|
@@ -1483,12 +1436,11 @@ int main(int argc, char *argv[])
|
|
|
|
|
else
|
|
|
|
|
ShowMessage("Cannot read file!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'g': // go to position in currently playing song
|
|
|
|
|
else if (Keypressed(input, Key.GoToPosition))
|
|
|
|
|
{
|
|
|
|
|
if (now_playing < 0)
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
int newpos = 0;
|
|
|
|
|
string position;
|
|
|
|
|
LOCK_STATUSBAR;
|
|
|
|
|
@@ -1498,14 +1450,13 @@ int main(int argc, char *argv[])
|
|
|
|
|
if (newpos > 0 && newpos < 100 && !position.empty())
|
|
|
|
|
Mpd->Seek(vPlaylist[now_playing]->GetTotalLength()*newpos/100.0);
|
|
|
|
|
UNLOCK_STATUSBAR;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'C': // clear playlist but holds currently playing song
|
|
|
|
|
else if (Keypressed(input, Key.Crop))
|
|
|
|
|
{
|
|
|
|
|
if (now_playing < 0)
|
|
|
|
|
{
|
|
|
|
|
ShowMessage("Nothing is playing now!");
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (SongList::iterator it = vPlaylist.begin(); it != vPlaylist.begin()+now_playing; it++)
|
|
|
|
|
Mpd->QueueDeleteSongId((*it)->GetID());
|
|
|
|
|
@@ -1514,20 +1465,19 @@ int main(int argc, char *argv[])
|
|
|
|
|
ShowMessage("Deleting all songs except now playing one...");
|
|
|
|
|
Mpd->CommitQueue();
|
|
|
|
|
ShowMessage("Songs deleted!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'c': // clear playlist
|
|
|
|
|
else if (Keypressed(input, Key.Clear))
|
|
|
|
|
{
|
|
|
|
|
ShowMessage("Clearing playlist...");
|
|
|
|
|
Mpd->ClearPlaylist();
|
|
|
|
|
ShowMessage("Cleared playlist!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '/': case '?': // find forward/backward
|
|
|
|
|
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
|
|
|
|
{
|
|
|
|
|
if ((current_screen != csHelp && current_screen != csSearcher) || (current_screen == csSearcher && !vSearched.empty()))
|
|
|
|
|
if ((current_screen != csHelp && current_screen != csSearcher)
|
|
|
|
|
|| (current_screen == csSearcher && !vSearched.empty()))
|
|
|
|
|
{
|
|
|
|
|
string how = input == '/' ? "forward" : "backward";
|
|
|
|
|
string how = Keypressed(input, Key.FindForward) ? "forward" : "backward";
|
|
|
|
|
found_pos = 0;
|
|
|
|
|
vFoundPositions.clear();
|
|
|
|
|
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
|
|
|
|
@@ -1540,7 +1490,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
break;
|
|
|
|
|
transform(findme.begin(), findme.end(), findme.begin(), tolower);
|
|
|
|
|
|
|
|
|
|
if (input == '/') // forward
|
|
|
|
|
if (Keypressed(input, Key.FindForward)) // forward
|
|
|
|
|
{
|
|
|
|
|
for (int i = mCurrent->GetChoice(); i <= mCurrent->MaxChoice(); i++)
|
|
|
|
|
{
|
|
|
|
|
@@ -1569,20 +1519,19 @@ int main(int argc, char *argv[])
|
|
|
|
|
mCurrent->Highlighting(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ',': case '.': // go to previous/next found position
|
|
|
|
|
else if (Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
|
|
|
|
{
|
|
|
|
|
if (!vFoundPositions.empty())
|
|
|
|
|
{
|
|
|
|
|
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
mCurrent->Highlight(vFoundPositions.at(input == '.' ? ++found_pos : --found_pos));
|
|
|
|
|
mCurrent->Highlight(vFoundPositions.at(Keypressed(input, Key.NextFoundPosition) ? ++found_pos : --found_pos));
|
|
|
|
|
}
|
|
|
|
|
catch (std::out_of_range)
|
|
|
|
|
{
|
|
|
|
|
if (input == '.')
|
|
|
|
|
if (Keypressed(input, Key.NextFoundPosition))
|
|
|
|
|
{
|
|
|
|
|
mCurrent->Highlight(vFoundPositions.front());
|
|
|
|
|
found_pos = 0;
|
|
|
|
|
@@ -1594,9 +1543,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'l': // show lyrics
|
|
|
|
|
else if (Keypressed(input, Key.Lyrics))
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == sLyrics)
|
|
|
|
|
{
|
|
|
|
|
@@ -1608,7 +1556,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
REFRESH_MEDIA_LIBRARY_SCREEN;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
|
|
|
|
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
|
|
|
|
@@ -1649,9 +1597,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
sLyrics->Timeout(ncmpcpp_window_timeout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '1': // help screen
|
|
|
|
|
else if (Keypressed(input, Key.Help))
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent != sHelp)
|
|
|
|
|
{
|
|
|
|
|
@@ -1659,18 +1606,17 @@ int main(int argc, char *argv[])
|
|
|
|
|
wCurrent->Hide();
|
|
|
|
|
current_screen = csHelp;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case KEY_TAB: // switch between playlist and browser
|
|
|
|
|
else if (Keypressed(input, Key.ScreenSwitcher))
|
|
|
|
|
{
|
|
|
|
|
if (wCurrent == mPlaylist)
|
|
|
|
|
goto KEY_TAB_BROWSER_REDIRECT;
|
|
|
|
|
goto SWITCHER_BROWSER_REDIRECT;
|
|
|
|
|
else
|
|
|
|
|
goto KEY_TAB_PLAYLIST_REDIRECT;
|
|
|
|
|
goto SWITCHER_PLAYLIST_REDIRECT;
|
|
|
|
|
}
|
|
|
|
|
case '2': // playlist screen
|
|
|
|
|
else if (Keypressed(input, Key.Playlist))
|
|
|
|
|
{
|
|
|
|
|
KEY_TAB_PLAYLIST_REDIRECT:
|
|
|
|
|
SWITCHER_PLAYLIST_REDIRECT:
|
|
|
|
|
if (wCurrent != mPlaylist && current_screen != csTagEditor)
|
|
|
|
|
{
|
|
|
|
|
found_pos = 0;
|
|
|
|
|
@@ -1680,11 +1626,10 @@ int main(int argc, char *argv[])
|
|
|
|
|
current_screen = csPlaylist;
|
|
|
|
|
redraw_me = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '3': // browse screen
|
|
|
|
|
else if (Keypressed(input, Key.Browser))
|
|
|
|
|
{
|
|
|
|
|
KEY_TAB_BROWSER_REDIRECT:
|
|
|
|
|
SWITCHER_BROWSER_REDIRECT:
|
|
|
|
|
if (browsed_dir.empty())
|
|
|
|
|
browsed_dir = "/";
|
|
|
|
|
|
|
|
|
|
@@ -1719,9 +1664,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
current_screen = csBrowser;
|
|
|
|
|
redraw_me = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '4': // search screen
|
|
|
|
|
else if (Keypressed(input, Key.SearchEngine))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen != csTagEditor && current_screen != csSearcher)
|
|
|
|
|
{
|
|
|
|
|
@@ -1753,9 +1697,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '5': // artist library
|
|
|
|
|
else if (Keypressed(input, Key.MediaLibrary))
|
|
|
|
|
{
|
|
|
|
|
if (current_screen != csLibrary)
|
|
|
|
|
{
|
|
|
|
|
@@ -1782,12 +1725,11 @@ int main(int argc, char *argv[])
|
|
|
|
|
current_screen = csLibrary;
|
|
|
|
|
redraw_me = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'q': case 'Q': // quit
|
|
|
|
|
else if (Keypressed(input, Key.Quit))
|
|
|
|
|
main_exit = 1;
|
|
|
|
|
default: continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// key mapping end
|
|
|
|
|
}
|
|
|
|
|
Mpd->Disconnect();
|
|
|
|
|
curs_set(1);
|
|
|
|
|
|