base for custom keys configuration + a few minor fixes

This commit is contained in:
unknown
2008-08-22 16:05:44 +02:00
parent a41afee077
commit 72cb5d8217
6 changed files with 1282 additions and 1186 deletions

View File

@@ -61,6 +61,11 @@ extern string UNKNOWN_ARTIST;
extern string UNKNOWN_TITLE;
extern string UNKNOWN_ALBUM;
bool Keypressed(int in, const int *key)
{
return in == key[0] || in == key[1];
}
bool SortSongsByTrack(Song *a, Song *b)
{
return StrToInt(a->GetTrack()) < StrToInt(b->GetTrack());

View File

@@ -30,6 +30,7 @@
extern ncmpcpp_config Config;
bool Keypressed(int, const int *);
bool SortSongsByTrack(Song *, Song *);
bool CaseInsensitiveComparison(string, string);
void WindowTitle(const string &);

View File

@@ -269,7 +269,7 @@ void MPDConnection::GetPlaylistChanges(long long id, SongList &v) const
{
if (isConnected)
{
if (id == -1)
if (id < 0)
{
id = 0;
v.reserve(GetPlaylistLength());

View File

@@ -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);

View File

@@ -24,6 +24,103 @@ const string config_file = home_folder + "/.ncmpcpprc";
using std::ifstream;
void DefaultKeys(ncmpcpp_keys &keys)
{
const int null_key = 0x0fffffff;
keys.Up[0] = KEY_UP;
keys.Down[0] = KEY_DOWN;
keys.PageUp[0] = KEY_PPAGE;
keys.PageDown[0] = KEY_NPAGE;
keys.Home[0] = KEY_HOME;
keys.End[0] = KEY_END;
keys.Space[0] = 32;
keys.Enter[0] = 10;
keys.Delete[0] = KEY_DC;
keys.VolumeUp[0] = KEY_RIGHT;
keys.VolumeDown[0] = KEY_LEFT;
keys.ScreenSwitcher[0] = 9;
keys.Help[0] = '1';
keys.Playlist[0] = '2';
keys.Browser[0] = '3';
keys.SearchEngine[0] = '4';
keys.MediaLibrary[0] = '5';
keys.Stop[0] = 's';
keys.Pause[0] = 'P';
keys.Next[0] = '>';
keys.Prev[0] = '<';
keys.SeekForward[0] = 'f';
keys.SeekBackward[0] = 'b';
keys.ToggleRepeat[0] = 'r';
keys.ToggleRandom[0] = 'z';
keys.Shuffle[0] = 'Z';
keys.ToggleCrossfade[0] = 'x';
keys.SetCrossfade[0] = 'X';
keys.UpdateDB[0] = 'u';
keys.FindForward[0] = '/';
keys.FindBackward[0] = '?';
keys.NextFoundPosition[0] = '.';
keys.PrevFoundPosition[0] = ',';
keys.EditTags[0] = 'e';
keys.GoToPosition[0] = 'g';
keys.Lyrics[0] = 'l';
keys.Clear[0] = 'c';
keys.Crop[0] = 'C';
keys.MvSongUp[0] = 'm';
keys.MvSongDown[0] = 'n';
keys.SavePlaylist[0] = 'S';
keys.GoToNowPlaying[0] = 'o';
keys.ToggleAutoCenter[0] = 'U';
keys.GoToParentDir[0] = 263;
keys.Quit[0] = 'q';
keys.Up[1] = 'k';
keys.Down[1] = 'j';
keys.PageUp[1] = null_key;
keys.PageDown[1] = null_key;
keys.Home[1] = null_key;
keys.End[1] = null_key;
keys.Space[1] = null_key;
keys.Enter[1] = null_key;
keys.Delete[1] = 'd';
keys.VolumeUp[1] = '+';
keys.VolumeDown[1] = '-';
keys.ScreenSwitcher[1] = null_key;
keys.Help[1] = null_key;
keys.Playlist[1] = null_key;
keys.Browser[1] = null_key;
keys.SearchEngine[1] = null_key;
keys.MediaLibrary[1] = null_key;
keys.Stop[1] = null_key;
keys.Pause[1] = null_key;
keys.Next[1] = null_key;
keys.Prev[1] = null_key;
keys.SeekForward[1] = null_key;
keys.SeekBackward[1] = null_key;
keys.ToggleRepeat[1] = null_key;
keys.ToggleRandom[1] = null_key;
keys.Shuffle[1] = null_key;
keys.ToggleCrossfade[1] = null_key;
keys.SetCrossfade[1] = null_key;
keys.UpdateDB[1] = null_key;
keys.FindForward[1] = null_key;
keys.FindBackward[1] = null_key;
keys.NextFoundPosition[1] = null_key;
keys.PrevFoundPosition[1] = null_key;
keys.EditTags[1] = null_key;
keys.GoToPosition[1] = null_key;
keys.Lyrics[1] = null_key;
keys.Clear[1] = null_key;
keys.Crop[1] = null_key;
keys.MvSongUp[1] = null_key;
keys.MvSongDown[1] = null_key;
keys.SavePlaylist[1] = null_key;
keys.GoToNowPlaying[1] = null_key;
keys.ToggleAutoCenter[1] = null_key;
keys.GoToParentDir[1] = 127;
keys.Quit[1] = 'Q';
}
void DefaultConfiguration(ncmpcpp_config &conf)
{
conf.mpd_music_dir = "/var/lib/mpd/music";
@@ -240,3 +337,4 @@ void ReadConfiguration(ncmpcpp_config &conf)
}
}

View File

@@ -25,6 +25,55 @@
#include "ncmpcpp.h"
struct ncmpcpp_keys
{
int Up[2];
int Down[2];
int PageUp[2];
int PageDown[2];
int Home[2];
int End[2];
int Space[2];
int Enter[2];
int Delete[2];
int VolumeUp[2];
int VolumeDown[2];
int ScreenSwitcher[2];
int Help[2];
int Playlist[2];
int Browser[2];
int SearchEngine[2];
int MediaLibrary[2];
int Stop[2];
int Pause[2];
int Next[2];
int Prev[2];
int SeekForward[2];
int SeekBackward[2];
int ToggleRepeat[2];
int ToggleRandom[2];
int Shuffle[2];
int ToggleCrossfade[2];
int SetCrossfade[2];
int UpdateDB[2];
int FindForward[2];
int FindBackward[2];
int NextFoundPosition[2];
int PrevFoundPosition[2];
int EditTags[2];
int GoToPosition[2];
int Lyrics[2];
int Clear[2];
int Crop[2];
int MvSongUp[2];
int MvSongDown[2];
int SavePlaylist[2];
int GoToNowPlaying[2];
int ToggleAutoCenter[2];
int GoToParentDir[2];
int Quit[2];
};
struct ncmpcpp_config
{
string mpd_music_dir;
@@ -57,6 +106,7 @@ struct ncmpcpp_config
int message_delay_time;
};
void DefaultKeys(ncmpcpp_keys &);
void DefaultConfiguration(ncmpcpp_config &);
string GetLineValue(const string &);
string IntoStr(COLOR);