1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
|
/***************************************************************************
* Copyright (C) 2008-2010 by Andrzej Rybczak *
* electricityispower@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "mpdpp.h"
#include "global.h"
#include "help.h"
#include "settings.h"
#include "tag_editor.h"
using Global::MainHeight;
using Global::MainStartY;
Help *myHelp = new Help;
void Help::Init()
{
w = new Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, brNone);
GetKeybindings();
w->Flush();
isInitialized = 1;
}
void Help::Resize()
{
w->Resize(COLS, MainHeight);
w->MoveTo(0, MainStartY);
hasToBeResized = 0;
}
void Help::SwitchTo()
{
using Global::myScreen;
if (myScreen == this)
return;
if (!isInitialized)
Init();
if (hasToBeResized)
Resize();
if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen;
myScreen = this;
Global::RedrawHeader = 1;
}
std::basic_string<my_char_t> Help::Title()
{
return U("Help");
}
std::string Help::DisplayKeys(int *key, int size)
{
bool backspace = 1;
std::string result = "\t";
for (int i = 0; i < size; i++)
{
if (key[i] == NcmpcppKeys::NullKey);
else if (key[i] == 259)
result += "Up";
else if (key[i] == 258)
result += "Down";
else if (key[i] == 339)
result += "Page Up";
else if (key[i] == 338)
result += "Page Down";
else if (key[i] == 262)
result += "Home";
else if (key[i] == 360)
result += "End";
else if (key[i] == 32)
result += "Space";
else if (key[i] == 10)
result += "Enter";
else if (key[i] == 330)
result += "Delete";
else if (key[i] == 261)
result += "Right";
else if (key[i] == 260)
result += "Left";
else if (key[i] == 9)
result += "Tab";
else if (key[i] >= 1 && key[i] <= 26)
{
result += "Ctrl-";
result += key[i]+64;
}
else if (key[i] >= 265 && key[i] <= 276)
{
result += "F";
result += IntoStr(key[i]-264);
}
else if ((key[i] == 263 || key[i] == 127) && !backspace);
else if ((key[i] == 263 || key[i] == 127) && backspace)
{
result += "Backspace";
backspace = 0;
}
else
result += key[i];
result += " ";
}
if (result.length() > 12)
result = result.substr(0, 12);
for (size_t i = result.length(); i <= 12; result += " ", ++i) { }
result += ": ";
return result;
}
void Help::GetKeybindings()
{
*w << " " << fmtBold << "Keys - Movement\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Up) << "Move Cursor up\n";
*w << DisplayKeys(Key.Down) << "Move Cursor down\n";
*w << DisplayKeys(Key.UpAlbum) << "Move Cursor up one album\n";
*w << DisplayKeys(Key.DownAlbum) << "Move Cursor down one album\n";
*w << DisplayKeys(Key.UpArtist) << "Move Cursor up one artist\n";
*w << DisplayKeys(Key.DownArtist) << "Move Cursor down one artist\n";
*w << DisplayKeys(Key.PageUp) << "Page up\n";
*w << DisplayKeys(Key.PageDown) << "Page down\n";
*w << DisplayKeys(Key.Home) << "Home\n";
*w << DisplayKeys(Key.End) << "End\n";
*w << "\n";
if (Config.screen_switcher_previous)
*w << DisplayKeys(Key.ScreenSwitcher) << "Switch between current and last screen\n";
else
*w << DisplayKeys(Key.ScreenSwitcher) << "Switch between given sequence of screens\n";
*w << DisplayKeys(Key.Help) << "Help screen\n";
*w << DisplayKeys(Key.Playlist) << "Playlist screen\n";
*w << DisplayKeys(Key.Browser) << "Browse screen\n";
*w << DisplayKeys(Key.SearchEngine) << "Search engine\n";
*w << DisplayKeys(Key.MediaLibrary) << "Media library\n";
*w << DisplayKeys(Key.PlaylistEditor) << "Playlist editor\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.TagEditor) << "Tag editor\n";
# endif // HAVE_TAGLIB_H
# ifdef ENABLE_OUTPUTS
*w << DisplayKeys(Key.Outputs) << "Outputs\n";
# endif // ENABLE_OUTPUTS
# ifdef ENABLE_VISUALIZER
*w << DisplayKeys(Key.Visualizer) << "Music visualizer\n";
# endif // ENABLE_VISUALIZER
# ifdef ENABLE_CLOCK
*w << DisplayKeys(Key.Clock) << "Clock screen\n";
# endif // ENABLE_CLOCK
*w << "\n";
*w << DisplayKeys(Key.ServerInfo) << "MPD server info\n";
*w << "\n\n " << fmtBold << "Keys - Global\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Stop) << "Stop\n";
*w << DisplayKeys(Key.Pause) << "Pause\n";
*w << DisplayKeys(Key.Next) << "Next track\n";
*w << DisplayKeys(Key.Prev) << "Previous track\n";
*w << DisplayKeys(Key.Replay) << "Play current track from the beginning\n";
*w << DisplayKeys(Key.SeekForward) << "Seek forward\n";
*w << DisplayKeys(Key.SeekBackward) << "Seek backward\n";
*w << DisplayKeys(Key.VolumeDown) << "Decrease volume\n";
*w << DisplayKeys(Key.VolumeUp) << "Increase volume\n";
*w << "\n";
*w << DisplayKeys(Key.ToggleSpaceMode) << "Toggle space mode (select/add)\n";
*w << DisplayKeys(Key.ToggleAddMode) << "Toggle add mode\n";
*w << DisplayKeys(Key.ToggleMouse) << "Toggle mouse support\n";
*w << DisplayKeys(Key.ReverseSelection) << "Reverse selection\n";
*w << DisplayKeys(Key.DeselectAll) << "Deselect all items\n";
*w << DisplayKeys(Key.SelectAlbum) << "Select songs of album around cursor\n";
*w << DisplayKeys(Key.AddSelected) << "Add selected items to playlist/m3u file\n";
*w << "\n";
*w << DisplayKeys(Key.ToggleRepeat) << "Toggle repeat mode\n";
*w << DisplayKeys(Key.ToggleRandom) << "Toggle random mode\n";
*w << DisplayKeys(Key.ToggleSingle) << "Toggle single mode\n";
*w << DisplayKeys(Key.ToggleConsume) << "Toggle consume mode\n";
if (Mpd.Version() >= 16)
*w << DisplayKeys(Key.ToggleReplayGainMode) << "Toggle replay gain mode\n";
*w << DisplayKeys(Key.ToggleBitrateVisibility) << "Toggle bitrate visibility\n";
*w << DisplayKeys(Key.Shuffle) << "Shuffle playlist\n";
*w << DisplayKeys(Key.ToggleCrossfade) << "Toggle crossfade mode\n";
*w << DisplayKeys(Key.SetCrossfade) << "Set crossfade\n";
*w << DisplayKeys(Key.UpdateDB) << "Start a music database update\n";
*w << "\n";
*w << DisplayKeys(Key.ApplyFilter) << "Apply filter\n";
*w << DisplayKeys(Key.FindForward) << "Forward find\n";
*w << DisplayKeys(Key.FindBackward) << "Backward find\n";
*w << DisplayKeys(Key.PrevFoundPosition) << "Go to previous found position\n";
*w << DisplayKeys(Key.NextFoundPosition) << "Go to next found position\n";
*w << DisplayKeys(Key.ToggleFindMode) << "Toggle find mode (normal/wrapped)\n";
*w << DisplayKeys(Key.GoToContainingDir) << "Locate song in browser\n";
*w << DisplayKeys(Key.GoToMediaLibrary) << "Locate current song in media library\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.GoToTagEditor) << "Locate current song in tag editor\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.ToggleDisplayMode) << "Toggle display mode\n";
*w << DisplayKeys(Key.ToggleInterface) << "Toggle user interface\n";
*w << DisplayKeys(Key.ToggleSeparatorsInPlaylist) << "Toggle displaying separators between albums\n";
*w << DisplayKeys(Key.GoToPosition) << "Go to given position in current song (in % by default)\n";
*w << DisplayKeys(Key.SongInfo) << "Show song info\n";
# ifdef HAVE_CURL_CURL_H
*w << DisplayKeys(Key.ArtistInfo) << "Show artist info\n";
*w << DisplayKeys(Key.ToggleLyricsDB) << "Toggle lyrics database\n";
# endif // HAVE_CURL_CURL_H
*w << DisplayKeys(Key.Lyrics) << "Show/hide song's lyrics\n";
*w << "\n";
*w << DisplayKeys(Key.Quit) << "Quit\n";
*w << "\n\n " << fmtBold << "Keys - Playlist\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Play\n";
*w << DisplayKeys(Key.SwitchTagTypeList) << "Add random songs/artists/albums to playlist\n";
*w << DisplayKeys(Key.Delete) << "Delete item/selected items from playlist\n";
*w << DisplayKeys(Key.Clear) << "Clear playlist\n";
*w << DisplayKeys(Key.Crop) << "Clear playlist but hold currently playing/selected items\n";
*w << DisplayKeys(Key.MvSongUp) << "Move item(s) up\n";
*w << DisplayKeys(Key.MvSongDown) << "Move item(s) down\n";
*w << DisplayKeys(Key.MoveTo) << "Move selected item(s) to cursor position\n";
*w << DisplayKeys(Key.MoveBefore) << "Move selected item(s) before cursor position\n";
*w << DisplayKeys(Key.MoveAfter) << "Move selected item(s) after cursor position\n";
*w << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit song's tags\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
*w << DisplayKeys(Key.SortPlaylist) << "Sort/reverse playlist\n";
*w << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
*w << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n";
*w << "\n\n " << fmtBold << "Keys - Browser\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Enter directory/Add item to playlist and play\n";
*w << DisplayKeys(Key.Space) << "Add item to playlist\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit song's tags/Rename playlist/directory\n";
# else
*w << DisplayKeys(Key.EditTags) << "Rename playlist/directory\n";
# endif // HAVE_TAGLIB_H
if (Mpd.GetHostname()[0] == '/') // are we connected to unix socket?
*w << DisplayKeys(Key.Browser) << "Browse MPD database/local filesystem\n";
*w << DisplayKeys(Key.SwitchTagTypeList) << "Toggle sort order\n";
*w << DisplayKeys(Key.GoToNowPlaying) << "Locate currently playing song\n";
*w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory\n";
*w << DisplayKeys(Key.Delete) << "Delete playlist/file/directory\n";
*w << DisplayKeys(Key.GoToContainingDir) << "Jump to playlist editor (playlists only)\n";
*w << "\n\n " << fmtBold << "Keys - Search engine\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Add item to playlist and play/change option\n";
*w << DisplayKeys(Key.Space) << "Add item to playlist\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit song's tags\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.ToggleSingle) << "Start searching immediately\n";
*w << DisplayKeys(Key.SearchEngine) << "Reset search engine\n";
*w << "\n\n " << fmtBold << "Keys - Media library\n -----------------------------------------\n" << fmtBoldEnd;
if (!Config.media_library_disable_two_column_mode)
*w << DisplayKeys(Key.MediaLibrary) << "Switch between two/three columns\n";
*w << DisplayKeys(&Key.VolumeDown[0], 1) << "Previous column\n";
*w << DisplayKeys(&Key.VolumeUp[0], 1) << "Next column\n";
*w << DisplayKeys(Key.Enter) << "Add to playlist and play song/album/artist's songs\n";
*w << DisplayKeys(Key.Space) << "Add to playlist song/album/artist's songs\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit main tag/album/song's tags\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.SwitchTagTypeList) << "Tag type list switcher (left column)\n";
*w << "\n\n " << fmtBold << "Keys - Playlist Editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(&Key.VolumeDown[0], 1) << "Previous column\n";
*w << DisplayKeys(&Key.VolumeUp[0], 1) << "Next column\n";
*w << DisplayKeys(Key.Enter) << "Add item to playlist and play\n";
*w << DisplayKeys(Key.Space) << "Add to playlist/select item\n";
# ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit playlist's name/song's tags\n";
# else
*w << DisplayKeys(Key.EditTags) << "Edit playlist's name\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.MvSongUp) << "Move item(s) up\n";
*w << DisplayKeys(Key.MvSongDown) << "Move item(s) down\n";
*w << DisplayKeys(Key.Clear) << "Clear current playlist\n";
*w << "\n\n " << fmtBold << "Keys - Lyrics\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Space) << "Switch for following lyrics of now playing song\n";
*w << DisplayKeys(Key.EditTags) << "Open lyrics in external editor\n";
*w << DisplayKeys(Key.SwitchTagTypeList) << "Refetch lyrics\n";
*w << "\n\n " << fmtBold << "Keys - Artist info\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.SwitchTagTypeList) << "Refetch artist info\n";
# ifdef HAVE_TAGLIB_H
*w << "\n\n " << fmtBold << "Keys - Tiny tag editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Edit tag\n";
*w << DisplayKeys(Key.ToggleSingle) << "Save\n";
*w << "\n\n " << fmtBold << "Keys - Tag editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Change tag/filename for one song (left column)\n";
*w << DisplayKeys(Key.Enter) << "Perform operation on all/selected songs (middle column)\n";
*w << DisplayKeys(Key.Space) << "Switch to albums/directories view (left column)\n";
*w << DisplayKeys(Key.Space) << "Select/deselect song (right column)\n";
*w << DisplayKeys(&Key.VolumeDown[0], 1) << "Previous column\n";
*w << DisplayKeys(&Key.VolumeUp[0], 1) << "Next column\n";
*w << DisplayKeys(Key.GoToParentDir) << "Go to parent directory (left column, directories view)\n";
# endif // HAVE_TAGLIB_H
# ifdef ENABLE_OUTPUTS
*w << "\n\n " << fmtBold << "Keys - Outputs\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Enter) << "Enable/disable output\n";
# endif // ENABLE_OUTPUTS
# if defined(ENABLE_VISUALIZER) && defined(HAVE_FFTW3_H)
*w << "\n\n " << fmtBold << "Keys - Music visualizer\n -----------------------------------------\n" << fmtBoldEnd;
*w << DisplayKeys(Key.Space) << "Toggle visualization type\n";
# endif // ENABLE_VISUALIZER && HAVE_FFTW3_H
*w << "\n\n " << fmtBold << "Mouse - Global\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click on \"Playing/Paused\" " << ": Play/pause\n";
*w << "\tLeft click on progressbar " << ": Go to chosen position in played track\n";
*w << "\n";
*w << "\tMouse wheel on \"Volume: xx\" " << ": Change volume\n";
*w << "\tMouse wheel on main window " << ": Scroll\n";
*w << "\n\n " << fmtBold << "Mouse - Playlist\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click " << ": Highlight\n";
*w << "\tRight click " << ": Play\n";
*w << "\n\n " << fmtBold << "Mouse - Browser\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click on directory " << ": Enter directory\n";
*w << "\tRight click on directory " << ": Add to playlist\n";
*w << "\n";
*w << "\tLeft click on song/playlist " << ": Add to playlist\n";
*w << "\tRight click on song/playlist " << ": Add to playlist and play\n";
*w << "\n\n " << fmtBold << "Mouse - Search engine\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click " << ": Highlight/switch value\n";
*w << "\tRight click " << ": Change value\n";
*w << "\n\n " << fmtBold << "Mouse - Media library\n -----------------------------------------\n" << fmtBoldEnd;
*w << fmtBold << "\tLeft/middle column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Highlight\n";
*w << "\t\tRight Click " << ": Add to playlist\n";
*w << "\n";
*w << fmtBold << "\tRight column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Add to playlist\n";
*w << "\t\tRight Click " << ": Add to playlist and play\n";
*w << "\n\n " << fmtBold << "Mouse - Playlist editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << fmtBold << "\tLeft column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Highlight\n";
*w << "\t\tRight Click " << ": Add to playlist\n";
*w << "\n";
*w << fmtBold << "\tRight column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Add to playlist\n";
*w << "\t\tRight Click " << ": Add to playlist and play\n";
# ifdef HAVE_TAGLIB_H
*w << "\n\n " << fmtBold << "Mouse - Tiny tag editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click " << ": Highlight\n";
*w << "\tRight click " << ": Change value/execute command\n";
*w << "\n\n " << fmtBold << "Mouse - Tag editor\n -----------------------------------------\n" << fmtBoldEnd;
*w << fmtBold << "\tLeft column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Enter directory/highlight album\n";
*w << "\t\tRight Click " << ": Switch to directories/albums view\n";
*w << "\n";
*w << fmtBold << "\tMiddle column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Highlight\n";
*w << "\t\tRight Click " << ": Change value/execute command\n";
*w << "\n";
*w << fmtBold << "\tRight column:\n" << fmtBoldEnd;
*w << "\t\tLeft Click " << ": Highlight\n";
*w << "\t\tRight Click " << ": Change value\n";
# endif // HAVE_TAGLIB_H
# ifdef ENABLE_OUTPUTS
*w << "\n\n " << fmtBold << "Mouse - Outputs\n -----------------------------------------\n" << fmtBoldEnd;
*w << "\tLeft click " << ": Highlight\n";
*w << "\tRight click " << ": Enable/disable output\n";
# endif // ENABLE_OUTPUTS
}
|